feat!: improve developer experience with breaking API changes #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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Extract changelog for this version | |
| id: changelog | |
| run: | | |
| # Extract the changelog section for this version | |
| version="${{ steps.version.outputs.version }}" | |
| # Use awk to extract the section between this version and the next | |
| changelog=$(awk -v ver="$version" ' | |
| /^## \[/ { | |
| if (found) exit | |
| if ($0 ~ "\\[" ver "\\]") found=1 | |
| next | |
| } | |
| found && /^## \[/ { exit } | |
| found { print } | |
| ' CHANGELOG.md) | |
| # Write to file to preserve formatting | |
| echo "$changelog" > /tmp/release_notes.md | |
| # Set output (escape newlines for GitHub Actions) | |
| { | |
| echo 'notes<<EOF' | |
| cat /tmp/release_notes.md | |
| echo 'EOF' | |
| } >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: v${{ steps.version.outputs.version }} | |
| body: ${{ steps.changelog.outputs.notes }} | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.version, '-') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |