-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (52 loc) · 1.84 KB
/
deploy.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
name: Deploy to Google Cloud Storage
on:
# trigger action manually
workflow_dispatch:
inputs:
deploy_to_production:
description: 'Deploy to production (DANGER)'
required: true
default: false
type: boolean
jobs:
deploy:
# only run deploy action in copies of the template repo
if: ${{ github.repository != 'rbb-data/svelte-starter' }}
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Create .env.local file
run: |
touch .env.local
echo GOOGLE_CONNECT_KEY=$GOOGLE_CONNECT_KEY >> .env.local
env:
GOOGLE_CONNECT_KEY: ${{ secrets.GOOGLE_CONNECT_KEY }}
- name: Install
run: npm ci
- name: Update data
run: npm run update:data
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GC_STORAGE_CREDENTIALS }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Deploy to production page
run: npm run deploy
if: ${{ github.event.inputs.deploy_to_production == 'true' }}
- name: Deploy to experimental page
run: npm run deploy--experimental
if: ${{ github.event.inputs.deploy_to_production == 'false' }}
- name: Import environment variables
run: cat .env >> $GITHUB_ENV
- name: Add job summary
run: echo Deployed to https://storage.googleapis.com${BASE_PATH}${SUFFIX}/index.html >> $GITHUB_STEP_SUMMARY
env:
BASE_PATH: ${{ env.BASE_PATH }}
SUFFIX: "${{ github.event.inputs.deploy_to_production == 'false' && '-experimental' || '' }}"