-
Notifications
You must be signed in to change notification settings - Fork 9
106 lines (93 loc) · 3.05 KB
/
backend_deploy_workflow.yaml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Deploy back-end
on:
workflow_call:
inputs:
environment:
type: string
description: "Github environment to use"
required: true
version:
type: string
description: "version to deploy"
required: true
jobs:
build_and_deploy_backend:
name: Build and deploy back-end
environment: ${{ inputs.environment }}
env:
IMAGE: europe-west1-docker.pkg.dev/marble-infra/marble/marble-backend:${{ inputs.version }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: auth github actions to GCP
id: auth
uses: google-github-actions/auth@v2
with:
token_format: access_token
project_id: ${{ vars.GCP_PROJECT_ID }}
workload_identity_provider: ${{ vars.WORKLOAD_IDENTITY_PROVIDER_ID }}
service_account: ${{ vars.SERVICE_ACCOUNT_EMAIL}}
- name: Login to Google Artifact Registry
uses: docker/login-action@v3
with:
registry: europe-west1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Extract version from tag
id: version
run: echo "MARBLE_VERSION=$(git describe --tags)" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
build-args: |
MARBLE_VERSION=${{ steps.version.outputs.MARBLE_VERSION }}
tags: ${{ env.IMAGE }}
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
with:
install_components: beta
- name: Deploy migration job
run: |
gcloud beta run jobs deploy migrations \
--quiet \
--image=${{ env.IMAGE }} \
--region="europe-west1" \
--execute-now \
--wait
- name: Deploy server
run: |
gcloud run deploy marble-backend \
--quiet \
--image=${{ env.IMAGE }} \
--region="europe-west1"
- name: Deploy execute scheduled scenario job
run: |
gcloud beta run jobs deploy scheduled-executer \
--quiet \
--image=${{ env.IMAGE }} \
--region="europe-west1"
- name: Deploy execute async worker service
run: |
gcloud beta run deploy marble-backend-worker \
--quiet \
--image=${{ env.IMAGE }} \
--region="europe-west1"
- name: Deploy data ingestion job
run: |
gcloud beta run jobs deploy data-ingestion \
--quiet \
--image=${{ env.IMAGE }} \
--region="europe-west1" \
- name: Deploy webhook retry
run: |
gcloud beta run jobs deploy retry-webhooks \
--quiet \
--image=${{ env.IMAGE }} \
--region="europe-west1" \