diff --git a/.github/workflows/publish-on-pypi.yml b/.github/workflows/publish-on-pypi.yml new file mode 100644 index 00000000..6ba23919 --- /dev/null +++ b/.github/workflows/publish-on-pypi.yml @@ -0,0 +1,32 @@ +name: Publish release to PyPI + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build-and-upload: + runs-on: ubuntu-latest + + steps: + - name: Check out the release commit + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install Python packages needed for build and upload + run: | + python -m pip install --upgrade pip + python -m pip install build twine + - name: Build sdist and wheel + run: | + python -m build + - name: Publish to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python -m twine check --strict dist/* + python -m twine upload dist/* diff --git a/docs/releases/upcoming/315.build.rst b/docs/releases/upcoming/315.build.rst new file mode 100644 index 00000000..ea34dffa --- /dev/null +++ b/docs/releases/upcoming/315.build.rst @@ -0,0 +1 @@ +Add GitHub Actions workflow for automatically publishing releases to PyPI. (#315)