-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (64 loc) · 2.14 KB
/
main.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
on:
push:
tags:
- v*
jobs:
deploy-client:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install NPM packages
run: cd client; npm i
- name: Create env file
run: echo '${{ secrets.ENV_FILE_PROD }}' > client/.env.prod
- name: Add COMMIT_HASH to env file
run: echo "COMMIT_HASH=$(git rev-parse --short=4 HEAD)" >> client/.env.prod
- name: Build client
run: cd client; npm run build
- name: Prepare authorization with Google Cloud
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS_PROD }}'
- name: Set up Google Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'
- name: Deploy to production environment
uses: FirebaseExtended/action-hosting-deploy@v0
with:
firebaseServiceAccount: '${{ secrets.GCP_CREDENTIALS_PROD }}'
expires: 30d
channelId: live
projectId: darci-gg
deploy-server:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install NPM packages
run: cd server; npm i
- name: Create env file
run: echo '${{ secrets.ENV_FILE_PROD }}' > server/.env.prod
- name: Add COMMIT_HASH to env file
run: echo "COMMIT_HASH=$(git rev-parse --short=4 HEAD)" >> server/.env.prod
- name: Build server
run: cd server; npm run build
- name: Prepare authorization with Google Cloud
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS_PROD }}'
- name: Set up Google Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'
- name: Deploy to production environment
run: cd server; ./deploy-prod.sh