-
Notifications
You must be signed in to change notification settings - Fork 5
140 lines (136 loc) · 6.58 KB
/
main.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Main CI
on: push
#push:
# branches:
# - main
#pull_request:
# types: [ opened, synchronize, reopened ]
# only one job should run at a time when deploying
concurrency:
group: ${{github.workflow}}-${{ github.ref_name != 'main' && !contains(github.event.head_commit.message, '[pulumi up]') && github.ref_name || 'deploying' }}
cancel-in-progress: false
jobs:
## Echo the group name to see if the concurrency is working
#echo-group:
# runs-on: ubuntu-latest
# steps:
# - name: Echo group name
# run: echo ${{github.workflow}}-${{ github.ref_name != 'main' && !contains(github.event.head_commit.message, '[pulumi up]') && github.ref_name || 'deploying' }}
# Setup envs
setup-env:
uses: ./.github/workflows/setup-env.yml
secrets: inherit
with:
target-environment: dev
# Backend
test-backend:
uses: ./.github/workflows/unit-test-backend.yml
secrets: inherit
needs: [ setup-env ]
with:
target-environment: dev
backend-url: ${{ needs.setup-env.outputs.backend-url }}
frontend-url: ${{ needs.setup-env.outputs.frontend-url }}
taxonomy-database-name: ${{ needs.setup-env.outputs.taxonomy-database-name }}
taxonomy-model-id: ${{ needs.setup-env.outputs.taxonomy-model-id }}
application-database-name: ${{ needs.setup-env.outputs.application-database-name }}
userdata-database-name: ${{ needs.setup-env.outputs.userdata-database-name }}
vertex-api-region: ${{ needs.setup-env.outputs.vertex-api-region }}
build-frontend:
uses: ./.github/workflows/build-frontend.yml
secrets: inherit
with:
target-environment: dev
deploy-auth:
# This job will only run if the push event is on the main branch or the commit message contains '[pulumi up]'
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[pulumi up]'))
uses: ./.github/workflows/deploy-auth.yml
needs: [ setup-env ]
secrets: inherit
with:
target-environment: dev
frontend-domain: ${{ needs.setup-env.outputs.frontend-domain }}
deploy-backend:
# This job will only run if the push event is on the main branch or the commit message contains '[pulumi up]'
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[pulumi up]'))
needs: [ test-backend, setup-env ]
uses: ./.github/workflows/deploy-backend.yml
secrets: inherit
with:
target-environment: dev
backend-url: ${{ needs.setup-env.outputs.backend-url }}
frontend-url: ${{ needs.setup-env.outputs.frontend-url }}
taxonomy-database-name: ${{ needs.setup-env.outputs.taxonomy-database-name }}
taxonomy-model-id: ${{ needs.setup-env.outputs.taxonomy-model-id }}
application-database-name: ${{ needs.setup-env.outputs.application-database-name }}
userdata-database-name: ${{ needs.setup-env.outputs.userdata-database-name }}
vertex-api-region: ${{ needs.setup-env.outputs.vertex-api-region }}
smoke-test-backend-apigateway:
needs: [ deploy-backend ]
uses: ./.github/workflows/smoke-test-backend-version.yml
secrets: inherit
with:
component: backend
expected-version-info: ${{ needs.deploy-backend.outputs.version-info }}
component-url: ${{ needs.deploy-backend.outputs.api-gateway-url }}
get-version-url: /version
deploy-frontend:
# This job will only run if the push event is on the main branch or the commit message contains '[pulumi up]'
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[pulumi up]'))
needs: [ setup-env, build-frontend, deploy-auth ]
uses: ./.github/workflows/deploy-frontend.yml
secrets: inherit
with:
target-environment: dev
backend-url: ${{ needs.setup-env.outputs.backend-url }}
identity_platform_client_api_key: ${{ needs.deploy-auth.outputs.identity_platform_client_api_key }}
identity_platform_client_firebase_auth_domain: ${{ needs.deploy-auth.outputs.identity_platform_client_firebase_auth_domain }}
sensitive-data-encryption-key: ${{ needs.setup-env.outputs.sensitive-data-encryption-key }}
sensitive-data-encryption-key-id: ${{ needs.setup-env.outputs.sensitive-data-encryption-key-id }}
smoke-test-frontend-bucket:
needs: [ setup-env, build-frontend, deploy-frontend ]
uses: ./.github/workflows/smoke-test-frontend-version.yml
secrets: inherit
with:
component: frontend-new
expected-version-info: ${{ needs.build-frontend.outputs.version-info }}
component-url: ${{ needs.deploy-frontend.outputs.frontend-url }}
deploy-common:
# This job will only run if the push event is on the main branch or the commit message contains '[pulumi up]'
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[pulumi up]'))
needs: [ setup-env, deploy-frontend, smoke-test-backend-apigateway, smoke-test-frontend-bucket ]
uses: ./.github/workflows/deploy-common.yml
secrets: inherit
with:
target-environment: dev
domain-name: ${{ needs.setup-env.outputs.domain-name }}
frontend-domain: ${{ needs.setup-env.outputs.frontend-domain }}
frontend-url: ${{ needs.setup-env.outputs.frontend-url }}
backend-domain: ${{ needs.setup-env.outputs.backend-domain }}
backend-url: ${{ needs.setup-env.outputs.backend-url }}
deploy-aws-ns:
# This job will only run if the push event is on the main branch or the commit message contains '[pulumi up]'
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[pulumi up]'))
needs: [ setup-env, deploy-common ]
uses: ./.github/workflows/deploy-aws-ns.yml
secrets: inherit
with:
target-environment: dev
domain-name: ${{ needs.setup-env.outputs.domain-name }}
smoke-test-backend:
needs: [ setup-env, deploy-backend, deploy-aws-ns ]
uses: ./.github/workflows/smoke-test-backend-version.yml
secrets: inherit
with:
component: backend
expected-version-info: ${{ needs.deploy-backend.outputs.version-info }}
component-url: ${{ needs.setup-env.outputs.backend-url }}
get-version-url: /version
smoke-test-frontend:
needs: [ setup-env, build-frontend, deploy-frontend, deploy-aws-ns ]
uses: ./.github/workflows/smoke-test-frontend-version.yml
secrets: inherit
with:
component: frontend-new
expected-version-info: ${{ needs.build-frontend.outputs.version-info }}
component-url: ${{ needs.setup-env.outputs.frontend-url }}