Skip to content

Commit 37ccc60

Browse files
committed
Add link to release notes and custom header
1 parent 52cbd72 commit 37ccc60

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

.github/workflows/release-prod.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,23 +133,26 @@ jobs:
133133
134134
# Get the release notes from the description of the most recent merged PR into the "release" branch
135135
# See: https://github.com/firebase/firebase-js-sdk/pull/8236 for an example description
136-
RELEASE_NOTES=$(gh pr list \
136+
JSON_RELEASE_NOTES=$(gh pr list \
137137
--repo "$GITHUB_REPOSITORY" \
138138
--state "merged" \
139139
--base "release" \
140140
--limit 1 \
141141
--json "body" \
142-
| jq '.[].body' \
143-
| jq -r . \
144-
| sed '1,/^# Releases/d' \
142+
| jq '.[].body | split("\n# Releases\n")[-1]' # Remove the generated changesets header
145143
)
144+
145+
# Prepend the new release header
146+
# We have to be careful to insert the new release header after a " character, since we're
147+
# modifying the JSON string
148+
JSON_RELEASE_NOTES="\"For more detailed release notes, see [Firebase JavaScript SDK Release Notes](https://firebase.google.com/support/release-notes/js).\n\n# What's Changed\n\n${JSON_RELEASE_NOTES:1}"
146149
147-
# Prepend the Firebase release notes link and header
148-
RELEASE_NOTES="For more detailed release notes, see [Firebase JavaScript SDK Release Notes](https://firebase.google.com/support/release-notes/js).\n\n# What's Changed\n\n${RELEASE_NOTES}"
150+
# Format the JSON string into a readable markdown string
151+
RELEASE_NOTES=$(echo -E $JSON_RELEASE_NOTES | jq -r .)
149152
150153
# Create the GitHub release
151154
gh release create "$NEWEST_TAG" \
152-
--repo="$GITHUB_REPOSITORY" \
153-
--title="$NEWEST_TAG" \
155+
--repo "$GITHUB_REPOSITORY" \
156+
--title "$NEWEST_TAG" \
154157
--notes "$RELEASE_NOTES" \
155158
--verify-tag

0 commit comments

Comments
 (0)