-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (87 loc) · 2.68 KB
/
ci.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
name: CI
"on":
push:
schedule:
- cron: "0 7 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
- name: Install dependencies
run: npm ci && cd functions && npm ci && cd ..
- name: Lint
run: npm run lint
# - name: Test
# run: npm run test
buildFrontend:
name: Build Frontend
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
- name: Install dependencies
run: npm ci && cd functions && npm ci && cd ..
- name: Build Project for Production
run: npm run build
env:
BASE: "/"
BASE_URL: "https://adrianjost.dev"
deployFrontend:
name: Deploy Frontend
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
- name: Install dependencies
run: npm ci && cd functions && npm ci && cd ..
- name: Build Project for Production
run: npm run build
env:
BASE: "/"
BASE_URL: "https://adrianjost.dev"
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_CURRICULUM_VITAE_5CD0A }}"
channelId: live
projectId: curriculum-vitae-5cd0a
deployBackend:
name: Deploy Backend
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
- name: Install dependencies
run: npm ci && cd functions && npm ci && cd ..
- name: Deploy to Firebase
run: npx -p firebase-tools firebase deploy --only functions --token $FIREBASE_TOKEN
env:
FIREBASE_TOKEN: "${{ secrets.FIREBASE_TOKEN }}"