-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (76 loc) · 2.25 KB
/
website.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Website - Test, Build, and Deploy to GCP
on:
push:
paths:
- 'src/website/**'
- '.github/workflows/website.yml'
- '.github/actions/website/**'
- 'src/common/**'
defaults:
run:
working-directory: src/website
permissions:
id-token: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: src/website/.node-version
- run: |
npm ci
cd ../common && npm ci
- name: Test
run: |
npm run lint
deploy-staging:
name: Build, and Deploy to Staging
runs-on: ubuntu-latest
needs: test
environment:
name: Staging
if: github.ref == 'refs/heads/staging'
steps:
- name: 🚀 Deploy
uses: agrc/cloud-run-docker-deploy-composite-action@v1
with:
docker-context: ./src
docker-file: ./src/website/Dockerfile
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
service: website
flags: |
--service-account=cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com
--min-instances=0
--allow-unauthenticated
deploy-prod:
name: Build, and Deploy to Production
runs-on: ubuntu-latest
needs: test
environment:
name: Production
if: github.ref == 'refs/heads/production'
steps:
- name: 🚀 Deploy
uses: agrc/cloud-run-docker-deploy-composite-action@v1
with:
docker-context: ./src
docker-file: ./src/website/Dockerfile
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
service: website
flags: |
--service-account=cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com
--min-instances=1
--allow-unauthenticated