Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,26 @@ jobs:

- name: Extract changelog
id: changelog
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
notes=$(awk '/^## \[${{ steps.version.outputs.version }}\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md)
{
echo "notes<<CHANGELOG_EOF"
echo "$notes"
echo "CHANGELOG_EOF"
} >> "$GITHUB_OUTPUT"
awk -v version="$VERSION" '
$0 ~ "^## \\[" version "\\]" {found=1; next}
/^## \[/{if(found) exit}
found{print}
' CHANGELOG.md > notes.md

- name: Create or update GitHub Release
run: |
if gh release view "$GITHUB_REF_NAME" &>/dev/null; then
echo "Release $GITHUB_REF_NAME already exists, updating..."
gh release edit "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes "${{ steps.changelog.outputs.notes }}"
--notes-file notes.md
else
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes "${{ steps.changelog.outputs.notes }}"
--notes-file notes.md
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading