-
Notifications
You must be signed in to change notification settings - Fork 12
48 lines (38 loc) · 1.33 KB
/
hpo-web.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
# This is a basic workflow to help you get started with Actions
name: HPO-WEB Static Deployment
# Controls when the workflow will run
on: workflow_dispatch
env:
GCLOUD_BUCKET: ${{ secrets.GCLOUD_PUBLIC_BUCKET }}
jobs:
load:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCLOUD_SA_KEY }}'
- name: Setup Google Cloud CLI
uses: 'google-github-actions/setup-gcloud@v1'
- name: Configure Node
uses: actions/setup-node@v3
with:
node-version: 16.10.0
cache: 'npm'
- name: Lint, Test, Build
run: |
npm install
npm run lint
npm run testci
npm run buildProd --if-present
- name: Set Project Version
run: echo "PROJECT_VERSION=$(cat package.json | jq -r '.version')" >> "$GITHUB_ENV"
- name: Set Github Hash
run: echo "GIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
- name: Deploy to GCS
run: |
gsutil -m cp -r dist/* "$GCLOUD_BUCKET/hpo-web-$PROJECT_VERSION-$GIT_HASH/"
gsutil -m rm -f "$GCLOUD_BUCKET/*" || true
gsutil -m rm -rf "$GCLOUD_BUCKET/assets/" || true
gsutil -m cp -r "$GCLOUD_BUCKET/hpo-web-$PROJECT_VERSION-$GIT_HASH/*" "$GCLOUD_BUCKET/"