v0.5.0 — citation audit, broader classifiers, Codecov badge #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to PyPI | |
| # Trigger on every published release. Pre-releases (`v0.4.0rc1` etc.) also | |
| # fire `published`, so just create a GitHub Release with a tag like | |
| # `v0.4.0` after the changelog is settled. | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: "Where to upload" | |
| required: true | |
| default: "pypi" | |
| type: choice | |
| options: | |
| - pypi | |
| - testpypi | |
| jobs: | |
| build: | |
| name: Build sdist + wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build tooling | |
| run: python -m pip install --upgrade build | |
| - name: Build distributions | |
| run: python -m build | |
| - name: Sanity-check distributions | |
| run: | | |
| python -m pip install --upgrade twine | |
| twine check dist/* | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish-testpypi: | |
| name: Upload to TestPyPI | |
| needs: build | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi' }} | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/qqa | |
| permissions: | |
| id-token: write # required for Trusted Publishing | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| skip-existing: true | |
| publish-pypi: | |
| name: Upload to PyPI | |
| needs: build | |
| if: > | |
| github.event_name == 'release' || | |
| (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/qqa | |
| permissions: | |
| id-token: write # required for Trusted Publishing | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true |