From 8f4547827b03495df91ba7514260a141bc6a2170 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Tue, 22 Feb 2022 12:50:20 +0100 Subject: [PATCH] CI: Create Action to publish to PyPI on release Creates a GitHub Action workflow that builds and published packaged distribution files to PyPI when a release is published in GitHub. The secret used in ${{ secrets.PYPI_API_TOKEN }} needs to be created on the settings page of your project on GitHub. At some point we should probably switch to pyproject.toml as defined in PEP 518. --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..417ef2bd500 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release +on: + release: + types: + - published + +jobs: + release: + name: Deploy release to PyPI + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Install dependencies + run: pip install -U pip wheel setuptools + - name: Build package + run: python setup.py sdist bdist_wheel + - name: Upload package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.pypi_password }}