Skip to content

Commit 05e3c32

Browse files
committed
Add changelog generation to Github release action
1 parent 598b748 commit 05e3c32

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,29 @@ jobs:
1515
steps:
1616
- name: Checkout repository
1717
uses: actions/checkout@v5
18+
with:
19+
# Required for changelog generation
20+
fetch-depth: 0
21+
fetch-tags: true
1822

1923
- name: Create addon zip
2024
run: |
2125
VERSION="${GITHUB_REF_NAME#v}"
2226
zip -r g3blend-${VERSION}.zip . -i 'g3blend/*'
2327
28+
- name: Generate changelog
29+
run: |
30+
PREV_TAG="$(git tag --sort=-version:refname --merged ${GITHUB_REF_NAME}~1 | head -n 1)"
31+
if [[ -n "${PREV_TAG}" ]]; then
32+
git log "${PREV_TAG}..${GITHUB_REF_NAME}~1" --pretty=format:"- %s%n%w(0,2,2)%b" > CHANGELOG_TEMP.md
33+
else
34+
echo "Unable to generate changelog: No previous tag found" > CHANGELOG_TEMP.md
35+
fi
36+
2437
- name: Create Draft Release.
2538
env:
2639
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2740
run: |
2841
VERSION="${GITHUB_REF_NAME#v}"
2942
gh release create ${{ github.ref_name }} g3blend-${VERSION}.zip \
30-
--title "g3blend ${VERSION}" --generate-notes --draft
43+
--title "g3blend ${VERSION}" --notes-file CHANGELOG_TEMP.md --draft

0 commit comments

Comments
 (0)