Skip to content

Commit

Permalink
Extracts the changelog entry into the release notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tommie committed Dec 29, 2023
1 parent e004460 commit da34a96
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,33 @@ jobs:
version=$(sed -e 's;^##\s\+\[\(v[0-9.]\+\)\].*;\1; p ; d' CHANGELOG.md | head -n 1)
(
echo "Full changelog ⇒ [$version](https://github.com/${{ github.repository }}/blob/$version/CHANGELOG.md)"
awk -v version="$version" '
/^##\s+\[.*?\]\s/ && $2 != "[" version "]" {
inside = 0;
}
inside && (inside == 2 || $0) {
gsub(/^#/, "");
print;
if ($0) { inside = 2; }
}
/^##\s+\[.*?\]\s/ && $2 == "[" version "]" {
inside = 1;
}' CHANGELOG.md | \
sed -Ez '$ s/\n+$/\n/'
) >releasenotes.md
echo "version=$version" >>"$GITHUB_OUTPUT"
echo "url=https://github.com/${{ github.repository }}/blob/$version/CHANGELOG.md" >>"$GITHUB_OUTPUT"
- id: create_release
name: Create Release
uses: ncipollo/release-action@v1
with:
commit: ${{ github.sha }}
tag: ${{ steps.changelog.outputs.version }}
body: |
Full changelog ⇒ [${{ steps.changelog.outputs.version }}](${{ steps.changelog.outputs.url }})
bodyFile: releasenotes.md
draft: true
allowUpdates: true
updateOnlyUnreleased: true
Expand Down

0 comments on commit da34a96

Please sign in to comment.