-
Notifications
You must be signed in to change notification settings - Fork 31
104 lines (80 loc) · 2.7 KB
/
firebase_deploy.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Build and Deploy to Firebase Hosting
on:
push:
branches:
- main
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '19'
- name: Install Dependencies
run: npm install --force
- name: Set Environment Variables
run: |
echo "VITE_BASE_API=${{ secrets.VITE_BASE_API }}" >> $GITHUB_ENV
echo "VITE_CDN_URL=${{ secrets.VITE_CDN_URL }}" >> $GITHUB_ENV
echo "VITE_DOMAIN_NAME=${{ secrets.VITE_DOMAIN_NAME }}" >> $GITHUB_ENV
echo "VITE_GITHUB_APP_AUTHORIZE_URL=${{ secrets.VITE_GITHUB_APP_AUTHORIZE_URL }}" >> $GITHUB_ENV
- name: Build Vite Project
run: npm run build
- name: Archive Build
uses: actions/upload-artifact@v3
with:
name: build
path: dist/
Deploy-Staging:
needs: [Build]
runs-on: ubuntu-latest
environment:
name: Preview
url: "https://enigma-web-preview.web.app"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '19'
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Install Dependencies
run: npm install --force
- name: Restore Build
uses: actions/download-artifact@v3
with:
name: build
- name: Set Environment Variables Staging
run: echo "FIREBASE_PROJECT_ID=${{ secrets.PREVIEW }}" >> $GITHUB_ENV
- name: Deploy to Firebase (Staging)
run: firebase deploy --token ${{ secrets.FIREBASE_TOKEN }} --only hosting --project ${{ env.FIREBASE_PROJECT_ID }}
Deploy-Production:
needs: [Build,Deploy-Staging]
runs-on: ubuntu-latest
environment:
name: Production
url: "https://enigma-dev-web.web.app"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '19'
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Install Dependencies
run: npm install --force
- name: Restore Build
uses: actions/download-artifact@v3
with:
name: build
- name: Set Environment Variables for Production
run: echo "FIREBASE_PROJECT_ID=${{ secrets.PRODUCTION }}" >> $GITHUB_ENV
- name: Deploy to Firebase (Production)
run: firebase deploy --token ${{ secrets.FIREBASE_TOKEN }} --only hosting --project ${{ env.FIREBASE_PROJECT_ID }}