-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add job to create a GitHub release (#8248)
* Add job to create a GitHub release * Add release notes link and header to beginning of release notes * Add link to release notes and custom header
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,3 +124,35 @@ jobs: | |
curl -X POST -H "Content-Type:application/json" \ | ||
-d "{\"version\":\"$BASE_VERSION\",\"date\":\"$DATE\"}" \ | ||
$RELEASE_TRACKER_URL/logProduction | ||
- name: Create Github release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Get the newest release tag for the firebase package (e.g. [email protected]) | ||
NEWEST_TAG=$(git describe --tags --match "firebase@[0-9]*.[0-9]*.[0-9]*" --abbrev=0) | ||
# Get the release notes from the description of the most recent merged PR into the "release" branch | ||
# See: https://github.com/firebase/firebase-js-sdk/pull/8236 for an example description | ||
JSON_RELEASE_NOTES=$(gh pr list \ | ||
--repo "$GITHUB_REPOSITORY" \ | ||
--state "merged" \ | ||
--base "release" \ | ||
--limit 1 \ | ||
--json "body" \ | ||
| jq '.[].body | split("\n# Releases\n")[-1]' # Remove the generated changesets header | ||
) | ||
# Prepend the new release header | ||
# We have to be careful to insert the new release header after a " character, since we're | ||
# modifying the JSON string | ||
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}" | ||
# Format the JSON string into a readable markdown string | ||
RELEASE_NOTES=$(echo -E $JSON_RELEASE_NOTES | jq -r .) | ||
# Create the GitHub release | ||
gh release create "$NEWEST_TAG" \ | ||
--repo "$GITHUB_REPOSITORY" \ | ||
--title "$NEWEST_TAG" \ | ||
--notes "$RELEASE_NOTES" \ | ||
--verify-tag |