chore(release): bump version to 0.8.0 (#255) #11
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Need full history for changelog parsing | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Validate version in pyproject.toml | |
| run: | | |
| PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| if [ "$PYPROJECT_VERSION" != "${{ steps.version.outputs.VERSION }}" ]; then | |
| echo "Error: Tag version (${{ steps.version.outputs.VERSION }}) does not match pyproject.toml version ($PYPROJECT_VERSION)" | |
| exit 1 | |
| fi | |
| - name: Extract release notes from CHANGELOG | |
| id: changelog | |
| run: | | |
| # Extract the section for this version from CHANGELOG.md | |
| # Looks for ## [VERSION] and captures until the next ## [ | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| # Use awk to extract the version section | |
| NOTES=$(awk -v ver="$VERSION" ' | |
| /^## \[/ { | |
| if (found) exit | |
| if ($0 ~ "\\[" ver "\\]") found=1 | |
| next | |
| } | |
| found { print } | |
| ' CHANGELOG.md) | |
| if [ -z "$NOTES" ]; then | |
| echo "Warning: No release notes found for version $VERSION in CHANGELOG.md" | |
| NOTES="Release ${{ steps.version.outputs.TAG }}" | |
| fi | |
| # Write to file for multi-line support | |
| echo "$NOTES" > release_notes.md | |
| echo "Found release notes for version $VERSION" | |
| - name: Create GitHub Release | |
| run: | | |
| PRERELEASE_FLAG="" | |
| if [[ "${{ steps.version.outputs.VERSION }}" == *-* ]]; then | |
| PRERELEASE_FLAG="--prerelease" | |
| fi | |
| gh release create "${{ steps.version.outputs.TAG }}" \ | |
| --title "${{ steps.version.outputs.TAG }}" \ | |
| --notes-file release_notes.md \ | |
| $PRERELEASE_FLAG | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |