-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (62 loc) · 1.75 KB
/
Copy pathmain.yml
File metadata and controls
70 lines (62 loc) · 1.75 KB
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
name: '[Main] lint, build_export and deploy'
on: push
# secrets:
# GCP_PROJECT_ID: id of the GCP project
# GCP_SA_KEY: json of service account's to access the GCP bucket
# GCP_BUCKET_NAME: GCP bucket name (object storage)
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14.12.0
- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run lint
build_export:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14.12.0
- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run build
- run: npm run export
- name: upload exported build
uses: actions/upload-artifact@v1
with:
name: out
path: out
deploy:
if: github.ref == 'refs/heads/master'
needs: build_export
runs-on: ubuntu-latest
steps:
- name: download exported build
uses: actions/download-artifact@v1
with:
name: out
- uses: google-github-actions/setup-gcloud@master
with:
version: '290.0.1'
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- run: gsutil -m rsync -r -d out/ "gs://${GCP_BUCKET_NAME}/"
env:
GCP_BUCKET_NAME: ${{ secrets.GCP_BUCKET_NAME }}