Skip to content

Commit 98e77ff

Browse files
committed
Create a workflow for auto update changelog
1 parent ac9bc19 commit 98e77ff

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/ci-auto-release.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@ jobs:
4343
VERSION="$(cat Version.txt)"
4444
echo "VERSION=$VERSION" >> $GITHUB_ENV
4545
46+
- name: Update changelog.md
47+
run: |
48+
NEW_CHANGELOG="## Version v${{ env.VERSION }}\n\n${{ steps.changelog.outputs.content }}\n"
49+
50+
# Insert new changelog before the first release section
51+
awk '/^## Release /{print NEW_CHANGELOG; NEW_CHANGELOG="";} 1' NEW_CHANGELOG="$NEW_CHANGELOG" changelog.md > temp && mv temp changelog.md
52+
53+
- name: Commit and push changelog
54+
run: |
55+
git config user.name "github-actions[bot]"
56+
git config user.email "github-actions[bot]@users.noreply.github.com"
57+
git add changelog.md Version.txt
58+
git commit -m "Update changelog and bump version to v${{ env.VERSION }}"
59+
git push origin main
60+
4661
- name: Get commit message
4762
id: message
4863
run: |
@@ -77,7 +92,7 @@ jobs:
7792
uses: peter-evans/create-pull-request@v6
7893
with:
7994
base: main
80-
add-paths: Version.txt
95+
add-paths: Version.txt changelog.md
8196
reviewers: mbudiu-vmw
8297
commit-message: ${{ steps.message.outputs.content }}
8398
signoff: false

0 commit comments

Comments
 (0)