-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (53 loc) · 1.62 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: "Continuous Deployment"
on:
push:
branches: ["master","next"]
jobs:
prep:
name: Cancel Previous Runs
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
buildAndDeploy:
name: Deploy
needs: prep
runs-on: ubuntu-latest
environment:
# see: https://github.com/actions/runner/issues/409#issuecomment-752775072
name: ${{ github.ref == 'refs/heads/master' && 'Production' || 'Staging' }}
steps:
- name: Checkout Repo
uses: actions/checkout@master
- uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
with:
working-directory: functions
- name: Build
run: npm run build
working-directory: functions
- name: Archive Production Artifact
uses: actions/upload-artifact@v2
with:
name: lib
path: functions/lib
- name: Deploy to Firebase
uses: w9jds/[email protected]
with:
args: deploy --only functions,firestore,extensions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
- name: Deploy to Firebase Hosting
uses: w9jds/[email protected]
if: ${{ github.ref == 'refs/heads/master' }}
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}