26
26
27
27
jobs :
28
28
stage_release :
29
- # If triggered by a PR it must contain the label 'release:build'.
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.
30
32
if : github.event.action == 'firebase_build' ||
31
- contains(github.event.pull_request.labels.*.name, 'release: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'))
32
36
33
37
runs-on : ubuntu-latest
34
38
@@ -50,10 +54,14 @@ jobs:
50
54
npm ci
51
55
npm run build
52
56
53
- - name : Run tests
54
- run : |
55
- npm test
56
- echo "Running integration tests"
57
+ - name : Run unit tests
58
+ run : npm test
59
+
60
+ - name : Run integration tests
61
+ run : ./.github/scripts/run_integration_tests.sh
62
+ env :
63
+ FIREBASE_SERVICE_ACCT_KEY : ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
64
+ FIREBASE_API_KEY : ${{ secrets.FIREBASE_API_KEY }}
57
65
58
66
- name : Package release artifacts
59
67
run : |
69
77
name : dist
70
78
path : dist
71
79
80
+ # TODO: Move this script to .github/scripts.
72
81
- name : Verify tarball
73
82
run : |
74
- PACKAGE_TARBALL=`ls *.tgz`
83
+ PACKAGE_TARBALL=`ls firebase-admin- *.tgz`
75
84
./verifyReleaseTarball.sh $PACKAGE_TARBALL
76
85
77
86
publish_release :
@@ -80,10 +89,12 @@ jobs:
80
89
# Check whether the release should be published. We publish only when the trigger PR is
81
90
# 1. merged
82
91
# 2. to the master branch
83
- # 3. with the title prefix '[chore] Release '.
84
- if : success() && github.event.pull_request.merged &&
85
- github.ref == 'master' &&
86
- startsWith(github.event.pull_request.title, '[chore] Release ')
92
+ # 3. with the label 'release:publish', and
93
+ # 4. the title prefix '[chore] Release '.
94
+ if : github.event.pull_request.merged &&
95
+ github.ref == 'master' &&
96
+ contains(github.event.pull_request.labels.*.name, 'release:publish') &&
97
+ startsWith(github.event.pull_request.title, '[chore] Release ')
87
98
88
99
runs-on : ubuntu-latest
89
100
@@ -122,11 +133,22 @@ jobs:
122
133
prerelease : false
123
134
124
135
- name : Publish to NPM
125
- run : echo Publishing to NPM
136
+ run : ./.github/scripts/publish_package.sh
137
+ env :
138
+ NPM_AUTH_TOKEN : ${{ secrets.NPM_AUTH_TOKEN }}
139
+ VERSION : ${{ steps.preflight.outputs.version }}
126
140
127
141
# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
128
142
- name : Post to Twitter
129
143
if : success() &&
130
144
contains(github.event.pull_request.labels.*.name, 'release:tweet')
131
- run : echo Posting Tweet
145
+ uses : ./.github/actions/send-tweet
146
+ with :
147
+ status : >
148
+ ${{ steps.preflight.outputs.version }} of @Firebase Admin Node.js SDK is avaialble.
149
+ https://github.com/firebase/firebase-admin-node/releases/tag/${{ steps.preflight.outputs.version }}
150
+ consumer-key : ${{ secrets.TWITTER_CONSUMER_KEY }}
151
+ consumer-secret : ${{ secrets.TWITTER_CONSUMER_SECRET }}
152
+ access-token : ${{ secrets.TWITTER_ACCESS_TOKEN }}
153
+ access-token-secret : ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
132
154
continue-on-error : true
0 commit comments