Skip to content

Commit d45f25b

Browse files
authored
[REL-4161] fix syntax error; add a bit more logging (#522)
Hopefully this will be the last one 😅. Yesterday evening I added the CHANGELOG update which I had overlooked initially because Releaser did it behind-the-scenes. But there was an extra `)` in the code 🤦, so that's fixed here, and I'm also logging out the changelog so future releasers will be able to see the diff and the updated CHANGELOG when they run a dry run or actual release. There's also a minor refactor here. It's nothing big, but it makes the updates a bit harder to grok, so I'll try to comment in the code to explain what was changed. <!-- 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 fc50d72 commit d45f25b

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

scripts/release/commit-and-tag.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,36 @@ tag_exists() (
1010
)
1111

1212
update_changelog() (
13-
local ts=$(date +"%Y-%m-%d"))
13+
local ts=$(date +"%Y-%m-%d")
1414
local changelog_entry=$(cat << EOF
1515
## [$LD_RELEASE_VERSION] - $ts
1616
$CHANGELOG_ENTRY
1717
EOF
18-
)
1918
2019
# insert the new changelog entry (followed by empty line) after line 4
2120
# of CHANGELOG.md
2221
sed -i "4r /dev/stdin" CHANGELOG.md <<< "$changelog_entry"$'\n'
22+
)
23+
24+
release_summary() (
25+
echo
26+
echo "Changes staged for release $RELEASE_TAG:"
27+
git diff
2328

29+
echo
30+
echo "Updated CHANGELOG:"
2431
cat CHANGELOG.md
32+
echo
2533
)
2634

27-
echo "Changes staged for release $RELEASE_TAG:"
28-
git diff
29-
30-
if [[ "$DRY_RUN" == "true" ]]; then
31-
echo "Dry run mode: skipping commit, tag, and push"
32-
update_changelog
33-
else
35+
commit_and_tag() (
3436
if tag_exists; then
3537
echo "Tag $RELEASE_TAG already exists. Aborting."
3638
exit 1
3739
fi
3840

3941
update_changelog
42+
release_summary
4043

4144
git config user.name "LaunchDarklyReleaseBot"
4245
git config user.email "[email protected]"
@@ -45,5 +48,13 @@ else
4548
git tag "${RELEASE_TAG}"
4649
git push origin HEAD
4750
git push origin "${RELEASE_TAG}"
51+
)
52+
53+
if [[ "$DRY_RUN" == "true" ]]; then
54+
update_changelog
55+
release_summary
56+
echo "Dry run mode: skipping commit, tag, and push"
57+
else
58+
commit_and_tag
4859
fi
4960

0 commit comments

Comments
 (0)