-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (50 loc) · 1.43 KB
/
staging-deploy.yml
File metadata and controls
58 lines (50 loc) · 1.43 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
name: Deploy Staging
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'signon-mock/**'
- 'cypress/**'
- 'cypress*'
- 'jest*'
- '.prettier*'
- '.eslint*'
- '.gitignore'
jobs:
deploy:
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci
- name: Build Project
run: npm run clean-build
- name: Generate Tag
id: generate_tag
run: |
echo "TAG=main-$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.1
with:
project_id: ${{ vars.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Deploy to Cloud Run
id: deploy
run: |
gcloud run deploy govuk-knowledge-graph-search \
--source . \
--region "europe-west2" \
--tag ${{ env.TAG }} \
--no-traffic \
--project ${{ vars.GCP_PROJECT_ID }}
- name: Route Traffic to New Revision
run: |
gcloud run services update-traffic govuk-knowledge-graph-search \
--to-tags ${{ env.TAG }}=100 \
--region "europe-west2" \
--project ${{ vars.GCP_PROJECT_ID }}