Skip to content

Commit 27c27c7

Browse files
committed
have pre-release workflow update CHANGELOG
1 parent 704936d commit 27c27c7

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

.github/workflows/pre-release-prepare.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ jobs:
9494
git commit -am "Update version to ${VERSION}"
9595
git push origin "v${VERSION}_release"
9696
97+
- name: Update CHANGELOG for release
98+
run: |
99+
# Replace "## Unreleased" with "## ${VERSION} - $(date +%Y-%m-%d)"
100+
sed -i "s/## Unreleased/## ${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
101+
git add CHANGELOG.md
102+
git commit -m "Update CHANGELOG for version ${VERSION}"
103+
git push origin "v${VERSION}_release"
104+
97105
- name: Create pull request against the release branch
98106
env:
99107
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
@@ -103,4 +111,24 @@ jobs:
103111
104112
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
105113
--head v${{ github.event.inputs.version }}_release \
106-
--base release/v${MAJOR_MINOR}.x
114+
--base release/v${MAJOR_MINOR}.x
115+
116+
- name: Create pull request against main for CHANGELOG
117+
env:
118+
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
119+
run: |
120+
# Create branch for main PR
121+
git checkout -b "v${VERSION}_changelog_main"
122+
123+
# Update CHANGELOG for main (keep Unreleased + add release entry)
124+
sed -i "s/## Unreleased/## Unreleased\n\n## ${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
125+
git add CHANGELOG.md
126+
git commit -m "Add ${VERSION} to CHANGELOG"
127+
git push origin "v${VERSION}_changelog_main"
128+
129+
gh pr create --title "Add ${VERSION} to CHANGELOG" \
130+
--body "This PR adds the ${VERSION} release entry to CHANGELOG.md.
131+
132+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
133+
--head v${{ github.event.inputs.version }}_changelog_main \
134+
--base main

0 commit comments

Comments
 (0)