Skip to content

Commit 54b8114

Browse files
Merge dev into master
2 parents 4343fa8 + 0d63b01 commit 54b8114

16 files changed

+1264
-306
lines changed

Diff for: .github/scripts/publish_post_check.sh

-105
This file was deleted.

Diff for: .github/scripts/publish_preflight_check.sh

+25
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ if [[ ! "${RELEASE_VERSION}" =~ ^([0-9]*)\.([0-9]*)\.([0-9]*)$ ]]; then
6464
fi
6565

6666
echo_info "Extracted release version: ${RELEASE_VERSION}"
67+
echo "::set-output name=version::v${RELEASE_VERSION}"
6768

6869

6970
echo_info ""
@@ -91,6 +92,30 @@ fi
9192
echo_info "Tag v${RELEASE_VERSION} does not exist."
9293

9394

95+
echo_info ""
96+
echo_info "--------------------------------------------"
97+
echo_info "Generating changelog"
98+
echo_info "--------------------------------------------"
99+
echo_info ""
100+
101+
echo_info "---< git fetch origin dev --prune --unshallow >---"
102+
git fetch origin dev --prune --unshallow
103+
echo ""
104+
105+
echo_info "Generating changelog from history..."
106+
readonly CURRENT_DIR=$(dirname "$0")
107+
readonly CHANGELOG=`${CURRENT_DIR}/generate_changelog.sh`
108+
echo "$CHANGELOG"
109+
110+
# Parse and preformat the text to handle multi-line output.
111+
# See https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870
112+
FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"`
113+
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//'%'/'%25'}"
114+
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\n'/'%0A'}"
115+
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\r'/'%0D'}"
116+
echo "::set-output name=changelog::${FILTERED_CHANGELOG}"
117+
118+
94119
echo ""
95120
echo_info "--------------------------------------------"
96121
echo_info "PREFLIGHT SUCCESSFUL"

Diff for: .github/workflows/ci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
GOPATH: ${{ github.workspace }}/go
1010
strategy:
1111
matrix:
12-
go: [1.11, 1.12, 1.13]
12+
go: [1.12, 1.13, 1.14]
1313
steps:
1414

1515
- name: Set up Go ${{ matrix.go }}
@@ -37,7 +37,6 @@ jobs:
3737

3838
- name: Run Formatter
3939
working-directory: ./go/src/firebase.google.com/go
40-
if: matrix.go != '1.11'
4140
run: |
4241
if [[ ! -z "$(gofmt -l -s .)" ]]; then
4342
echo "Go code is not formatted:"

Diff for: .github/workflows/publish.yml

-64
This file was deleted.

Diff for: .github/workflows/release.yml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Copyright 2020 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Release Candidate
16+
17+
on:
18+
# Only run the workflow when a PR is updated or when a developer explicitly requests
19+
# a build by sending a 'firebase_build' event.
20+
pull_request:
21+
types: [opened, synchronize, closed]
22+
23+
repository_dispatch:
24+
types:
25+
- firebase_build
26+
27+
jobs:
28+
stage_release:
29+
# To publish a release, merge the release PR with the label 'release:publish'.
30+
# To stage a release without publishing it, send a 'firebase_build' event or apply
31+
# the 'release:stage' label to a PR.
32+
if: github.event.action == 'firebase_build' ||
33+
contains(github.event.pull_request.labels.*.name, 'release:stage') ||
34+
(github.event.pull_request.merged &&
35+
contains(github.event.pull_request.labels.*.name, 'release:publish'))
36+
37+
runs-on: ubuntu-latest
38+
39+
env:
40+
GOPATH: ${{ github.workspace }}/go
41+
42+
# When manually triggering the build, the requester can specify a target branch or a tag
43+
# via the 'ref' client parameter.
44+
steps:
45+
- name: Check out code into GOPATH
46+
uses: actions/checkout@v2
47+
with:
48+
path: go/src/firebase.google.com/go
49+
ref: ${{ github.event.client_payload.ref || github.ref }}
50+
51+
- name: Set up Go
52+
uses: actions/setup-go@v1
53+
with:
54+
go-version: 1.11
55+
56+
- name: Get dependencies
57+
run: go get -t -v $(go list ./... | grep -v integration)
58+
59+
- name: Run Linter
60+
run: |
61+
echo
62+
go get golang.org/x/lint/golint
63+
$GOPATH/bin/golint -set_exit_status firebase.google.com/go/...
64+
65+
- name: Run Tests
66+
working-directory: ./go/src/firebase.google.com/go
67+
run: ./.github/scripts/run_all_tests.sh
68+
env:
69+
FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
70+
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
71+
72+
publish_release:
73+
needs: stage_release
74+
75+
# Check whether the release should be published. We publish only when the trigger PR is
76+
# 1. merged
77+
# 2. to the dev branch
78+
# 3. with the label 'release:publish', and
79+
# 4. the title prefix '[chore] Release '.
80+
if: github.event.pull_request.merged &&
81+
github.ref == 'dev' &&
82+
contains(github.event.pull_request.labels.*.name, 'release:publish') &&
83+
startsWith(github.event.pull_request.title, '[chore] Release ')
84+
85+
runs-on: ubuntu-latest
86+
87+
steps:
88+
- name: Checkout source for publish
89+
uses: actions/checkout@v2
90+
with:
91+
persist-credentials: false
92+
93+
- name: Publish preflight check
94+
id: preflight
95+
run: ./.github/scripts/publish_preflight_check.sh
96+
97+
# We authorize this step with an access token that has write access to the master branch.
98+
- name: Merge to master
99+
uses: actions/[email protected]
100+
with:
101+
github-token: ${{ secrets.FIREBASE_GITHUB_TOKEN }}
102+
script: |
103+
github.repos.merge({
104+
owner: context.repo.owner,
105+
repo: context.repo.repo,
106+
base: 'master',
107+
head: 'dev'
108+
})
109+
110+
# We pull this action from a custom fork of a contributor until
111+
# https://github.com/actions/create-release/pull/32 is merged. Also note that v1 of
112+
# this action does not support the "body" parameter.
113+
- name: Create release tag
114+
uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe
115+
env:
116+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
with:
118+
tag_name: ${{ steps.preflight.outputs.version }}
119+
release_name: Firebase Admin Go SDK ${{ steps.preflight.outputs.version }}
120+
body: ${{ steps.preflight.outputs.changelog }}
121+
commitish: master
122+
draft: false
123+
prerelease: false
124+
125+
# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
126+
- name: Post to Twitter
127+
if: success() &&
128+
contains(github.event.pull_request.labels.*.name, 'release:tweet')
129+
uses: firebase/firebase-admin-node/.github/actions/send-tweet@master
130+
with:
131+
status: >
132+
${{ steps.preflight.outputs.version }} of @Firebase Admin Go SDK is available.
133+
https://github.com/firebase/firebase-admin-go/releases/tag/${{ steps.preflight.outputs.version }}
134+
consumer-key: ${{ secrets.FIREBASE_TWITTER_CONSUMER_KEY }}
135+
consumer-secret: ${{ secrets.FIREBASE_TWITTER_CONSUMER_SECRET }}
136+
access-token: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN }}
137+
access-token-secret: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN_SECRET }}
138+
continue-on-error: true

0 commit comments

Comments
 (0)