-
Notifications
You must be signed in to change notification settings - Fork 9
59 lines (49 loc) · 1.54 KB
/
deploy-prod-api.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
name: Prod Build - API
on:
workflow_dispatch:
inputs:
notes:
description: "Notes"
required: false
default: ""
workflow_call:
secrets:
GCP_PROJECT_NAME:
required: true
WIP_PROJECT_ID:
required: true
repository_dispatch:
types: [bcd_release]
jobs:
deploy-prod-api:
name: Deploy to prod
runs-on: ubuntu-latest
environment: prod
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: api
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org/"
cache: npm
- run: npm ci
- run: npm update @mdn/browser-compat-data
- run: npm run generate
- name: Authenticate with GCP
uses: google-github-actions/auth@v0
with:
token_format: access_token
service_account: deploy-prod-bcd@${{ secrets.GCP_PROJECT_NAME }}.iam.gserviceaccount.com
workload_identity_provider: projects/${{ secrets.WIP_PROJECT_ID }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
- name: Sync Rumba API
run: |-
gsutil -m -h "Cache-Control:public, max-age=86400" rsync -r out/ gs://bcd-prod-mdn/bcd/api/
gsutil -m -h "Cache-Control:public, max-age=86400" rsync -d -r out/v0/current gs://bcd-prod-mdn/bcd/api/v0/current