name: GitHub Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Extract changelog section for this tag
id: notes
run: |
VERSION=${GITHUB_REF_NAME#v}
# Pull lines between '## [VERSION]' and the next '## [' heading.
awk -v ver="$VERSION" '
$0 ~ "^## \\[" ver "\\]" { capture=1; next }
capture && /^## \[/ { exit }
capture { print }
' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "No changelog section found for [$VERSION]" >&2
exit 1
fi
echo "Release notes for $VERSION:"
cat release-notes.md
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body_path: release-notes.md