Skip to content

Commit 0a64577

Browse files
authored
[REL-4161] add logic to update the changelog (#521)
Another follow up for the migration to GHA from Releaser for this repo. Releaser took care of updating the changelog, and I missed that I would need to include that in the GHA as well. The update will take place only after the release of the GHA, CircleCI Orb and BitBucket Pipe have completed successfully. <!-- ld-jira-link --> --- Related Jira issue: [REL-4161: Migrate ld-find-code-refs from Releaser to GHA](https://launchdarkly.atlassian.net/browse/REL-4161) <!-- end-ld-jira-link -->
1 parent 214c491 commit 0a64577

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
env:
2525
LD_RELEASE_VERSION: ${{ inputs.releaseVersion }}
2626
DRY_RUN: ${{ inputs.dryRun || 'false' }}
27+
CHANGELOG_ENTRY: ${{ inputs.changeLog }}
2728
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2829
ARTIFACT_DIRECTORY: "/tmp/release-artifacts"
2930
steps:

scripts/release/commit-and-tag.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,35 @@ tag_exists() (
99
git rev-parse "${RELEASE_TAG}" >/dev/null 2>&1
1010
)
1111

12+
update_changelog() (
13+
local ts=$(date +"%Y-%m-%d"))
14+
local changelog_entry=$(cat << EOF
15+
## [$LD_RELEASE_VERSION] - $ts
16+
$CHANGELOG_ENTRY
17+
EOF
18+
)
19+
20+
# insert the new changelog entry (followed by empty line) after line 4
21+
# of CHANGELOG.md
22+
sed -i "4r /dev/stdin" CHANGELOG.md <<< "$changelog_entry"$'\n'
23+
24+
cat CHANGELOG.md
25+
)
26+
1227
echo "Changes staged for release $RELEASE_TAG:"
1328
git diff
1429

1530
if [[ "$DRY_RUN" == "true" ]]; then
1631
echo "Dry run mode: skipping commit, tag, and push"
32+
update_changelog
1733
else
1834
if tag_exists; then
1935
echo "Tag $RELEASE_TAG already exists. Aborting."
2036
exit 1
2137
fi
2238

39+
update_changelog
40+
2341
git config user.name "LaunchDarklyReleaseBot"
2442
git config user.email "releasebot@launchdarkly.com"
2543
git add .

0 commit comments

Comments
 (0)