-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (55 loc) · 2.73 KB
/
firebase-hosting-merge.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
54
55
56
57
58
59
60
61
62
63
64
65
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on merge
on:
push:
branches: [main, dev]
jobs:
build_and_deploy:
runs-on: ubuntu-latest
env:
IS_PRODUCTION: ${{ endsWith(github.ref, 'main') }}
steps:
- uses: actions/checkout@master
- name: Use Node.js
uses: actions/setup-node@v3
- name: Set up firebase
run: yarn global add firebase-tools
- name: Choose dev firebase project
if: ${{ env.IS_PRODUCTION == 'false' }}
run: firebase use nwplus-ubc-dev --token ${{ secrets.FIREBASE_TOKEN }}
- name: Choose prod firebase project
if: ${{ env.IS_PRODUCTION == 'true' }}
run: firebase use nwplus-ubc --token ${{ secrets.FIREBASE_TOKEN }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build with dev env variables
if: ${{ env.IS_PRODUCTION == 'false' }}
run: yarn build:staging
env:
VITE_FIREBASE_API_KEY: ${{ secrets.DEV_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.DEV_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_DATABASE_URL: ${{ secrets.DEV_FIREBASE_DATABASE_URL }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.DEV_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.DEV_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.DEV_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.DEV_FIREBASE_APP_ID }}
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.DEV_FIREBASE_MEASUREMENT_ID }}
- name: Build with prod env variables
if: ${{ env.IS_PRODUCTION == 'true' }}
env:
VITE_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_DATABASE_URL: ${{ secrets.FIREBASE_DATABASE_URL }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.FIREBASE_MEASUREMENT_ID }}
run: yarn build
- name: Deploy to dev firebase project
if: ${{ env.IS_PRODUCTION == 'false' }}
run: firebase deploy --only hosting:nwplus-ubc-dev --non-interactive --token ${{ secrets.FIREBASE_TOKEN }}
- name: Choose prod firebase project
if: ${{ env.IS_PRODUCTION == 'true' }}
run: firebase deploy --only hosting:nwplus-ubc --non-interactive --token ${{ secrets.FIREBASE_TOKEN }}