-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (93 loc) · 3.66 KB
/
ci-cd-frontend.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
name: FRONTEND - Build - Test - Deploy
on:
push:
working-directory: frontend
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"
- name: Install Dependencies
run: yarn install
- name: Build Application
run: yarn build
env:
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
VITE_GOOGLE_MAP_API_KEY: ${{ secrets.VITE_GOOGLE_MAP_API_KEY }}
VITE_GOOGLE_PHOTO_REFERENCE: ${{ secrets.VITE_GOOGLE_PHOTO_REFERENCE }}
VITE_API_URL: ${{ secrets.VITE_API_URL }}
test:
runs-on: ubuntu-latest
needs: build
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"
- name: Install Dependencies
run: yarn install
- name: Run tests
run: yarn test
env:
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
VITE_GOOGLE_MAP_API_KEY: ${{ secrets.VITE_GOOGLE_MAP_API_KEY }}
VITE_GOOGLE_PHOTO_REFERENCE: ${{ secrets.VITE_GOOGLE_PHOTO_REFERENCE }}
VITE_API_URL: ${{ secrets.VITE_API_URL }}
VITE_STRIPE_KEY: ${{ secrets.VITE_STRIPE_KEY }}
deploy:
if: github.ref == 'refs/heads/main'
name: Deploy
needs: test
defaults:
run:
working-directory: ./frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"
- name: Install Dependencies
run: yarn install
- name: Build Application
run: yarn build
- name: Install firebase-tools
run: npm install -g firebase-tools
- name: Deploy
run: firebase deploy --only hosting --token $FIREBASE_TOKEN
env:
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
VITE_GOOGLE_MAP_API_KEY: ${{ secrets.VITE_GOOGLE_MAP_API_KEY }}
VITE_GOOGLE_PHOTO_REFERENCE: ${{ secrets.VITE_GOOGLE_PHOTO_REFERENCE }}
VITE_API_URL: ${{ secrets.VITE_API_URL }}
VITE_STRIPE_KEY: ${{ secrets.VITE_STRIPE_KEY }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}