chore(release): bump to 0.10.0 #14
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 pushed version tags (e.g. v0.1.0, v1.2.3) | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| # Run the full test suite before attempting a release build | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install package and test dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Run tests | |
| run: pytest tests/ -v | |
| # Build the sdist and wheel, then publish to PyPI | |
| publish: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| # The "pypi" environment must be created in the repo settings and | |
| # configured as a trusted publisher on pypi.org (see below). | |
| environment: pypi | |
| # Required for PyPI trusted publisher (OIDC) - no API token needed | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build tool | |
| run: pip install build | |
| - name: Build sdist and wheel | |
| run: python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Create a GitHub Release with the matching CHANGELOG section as release notes | |
| release: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract changelog section for this version | |
| run: | | |
| # Strip the leading 'v' from the tag name (e.g. v0.6.0 -> 0.6.0) | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| # Extract the section between the matching '## [X.Y.Z]' header and | |
| # the next '## [' version header, then write it to a temp file. | |
| awk "/^## \[${VERSION}\]/{found=1; next} found && /^## \[/{exit} found{print}" \ | |
| CHANGELOG.md > /tmp/release_notes.md | |
| # Fail the step if no notes were found for this version | |
| if [ ! -s /tmp/release_notes.md ]; then | |
| echo "No changelog section found for version ${VERSION}" | |
| exit 1 | |
| fi | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "${GITHUB_REF_NAME}" \ | |
| --repo "${GITHUB_REPOSITORY}" \ | |
| --title "${GITHUB_REF_NAME}" \ | |
| --notes-file /tmp/release_notes.md |