Production Release #3
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
# Copyright 2023 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Production Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release-branch: | |
description: 'Release branch' | |
type: string | |
default: 'release' | |
required: true | |
jobs: | |
deploy: | |
name: Production Release | |
runs-on: ubuntu-latest | |
# Allow GITHUB_TOKEN to have write permissions | |
permissions: | |
contents: write | |
steps: | |
- name: Set up node (20) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Checkout release branch (with history) | |
uses: actions/checkout@master | |
with: | |
# Release script requires git history and tags. | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.release-branch }} | |
- name: Push new git tags | |
run: | | |
git tag [email protected] | |
- 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 | |
RELEASE_NOTES=$(gh pr list \ | |
--repo "https://github.com/firebase/firebase-js-sdk" \ | |
--state "merged" \ | |
--base "release" \ | |
--limit 1 \ | |
--json "body" \ | |
| jq '.[].body'\ | |
| jq -r . \ | |
| sed '1,/^# Releases/d') | |
echo "Newest tag: $NEWEST_TAG" | |
echo "$RELEASE_NOTES" | |
# Create the GitHub release | |
gh release create "$NEWEST_TAG" \ | |
--repo="https://github.com/dlarocque/firebase-js-sdk" \ | |
--title="$NEWEST_TAG" \ | |
--notes "$RELEASE_NOTES" \ | |
--verify-tag |