ship requirements.txt in sdist so the wheel build works #2
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 | |
| # Triggered by pushing a version tag (e.g. v0.3.14): runs the test matrix, then | |
| # builds the package, publishes it to PyPI and creates a GitHub Release. | |
| # | |
| # PyPI upload uses Trusted Publishing (OIDC): no API token secret is needed, but | |
| # the repository/workflow must be registered once as a trusted publisher on PyPI | |
| # (PyPI project -> Settings -> Publishing -> add a GitHub Actions publisher with | |
| # workflow name "publish.yml"). | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install pytest | |
| - run: pytest tests/ | |
| publish: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # PyPI trusted publishing (OIDC) | |
| contents: write # create the GitHub Release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Build sdist and wheel | |
| run: | | |
| python -m pip install --upgrade pip build | |
| python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* | |
| generate_release_notes: true |