release: bump version to 2.2.0 and add new features #4
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
| # When you push a version tag (e.g. v1.6.0), create a GitHub Release and publish to PyPI. | |
| # Note: Creating a release with GITHUB_TOKEN does NOT trigger other workflows. | |
| # Docs versioning and deploy live in the docs repo. | |
| # | |
| # Usage: | |
| # git tag v1.6.0 | |
| # git push origin v1.6.0 | |
| # | |
| # PyPI: Add a Trusted Publisher on PyPI with workflow filename release-on-tag.yml (job: pypi-publish). | |
| name: Release on tag | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version from tag | |
| id: version | |
| run: | | |
| V="${GITHUB_REF#refs/tags/v}" | |
| echo "version=$V" >> $GITHUB_OUTPUT | |
| echo "Tag: v$V" | |
| - name: Extract changelog section | |
| run: | | |
| V="${{ steps.version.outputs.version }}" | |
| awk -v ver="$V" ' | |
| $0 ~ "^## \\[" ver "\\]" { found=1; next } | |
| found && /^## \[/ { exit } | |
| found { print } | |
| ' CHANGELOG.md > release_notes.md | |
| [ -s release_notes.md ] || echo "See CHANGELOG.md for details." > release_notes.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: v${{ steps.version.outputs.version }} | |
| body_path: release_notes.md | |
| draft: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |