16
16
- production
17
17
- sandbox-alpha
18
18
- sandbox-beta
19
- server_types :
19
+ server-types :
20
20
description : Server types to deploy
21
21
required : true
22
22
type : choice
26
26
- good-job
27
27
- sidekiq
28
28
default : all
29
- git_sha_to_deploy :
29
+ git-ref-to-deploy :
30
30
description : The git commit SHA to deploy.
31
31
required : false
32
32
type : string
35
35
environment :
36
36
required : true
37
37
type : string
38
- server_types :
38
+ server-types :
39
39
required : true
40
40
type : string
41
- git_sha_to_deploy :
41
+ git-ref-to-deploy :
42
42
description : The git commit SHA to deploy.
43
43
required : true
44
44
type : string
45
- app_version :
46
- description : The git ref to deploy (branch, tag, or commit SHA).
47
- required : false
48
- type : string
49
45
50
46
permissions : {}
51
47
56
52
aws-role : ${{ inputs.environment == 'production'
57
53
&& 'arn:aws:iam::820242920762:role/GithubDeployECSService'
58
54
|| 'arn:aws:iam::393416225559:role/GithubDeployECSService' }}
59
- aws_account_id : ${{ inputs.environment == 'production' && '820242920762' || '393416225559' }}
60
- cluster_name : mavis-${{ inputs.environment }}
61
- app_version : ${{ inputs.app_version == '' && 'unknown' || inputs.app_version }}
55
+ aws-account-id : ${{ inputs.environment == 'production' && '820242920762' || '393416225559' }}
56
+ cluster-name : mavis-${{ inputs.environment }}
57
+ app-version : ${{ inputs.git-ref-to-deploy == '' && 'unknown' || inputs.git-ref-to-deploy }}
62
58
63
59
jobs :
64
60
prepare-deployment :
@@ -69,12 +65,13 @@ jobs:
69
65
strategy :
70
66
fail-fast : true
71
67
matrix :
72
- service : ${{ inputs.server_types == 'all' && fromJSON('["web", "good-job", "sidekiq"]') || fromJSON(format('["{0}"]', inputs.server_types )) }}
68
+ service : ${{ inputs.server-types == 'all' && fromJSON('["web", "good-job", "sidekiq"]') || fromJSON(format('["{0}"]', inputs.server-types )) }}
73
69
steps :
74
70
- name : Checkout code
75
71
uses : actions/checkout@v5
72
+ id : checkout-code
76
73
with :
77
- ref : ${{ inputs.git_sha_to_deploy || github.sha }}
74
+ ref : ${{ inputs.git-ref-to-deploy || github.sha }}
78
75
- name : Configure AWS Credentials
79
76
uses : aws-actions/configure-aws-credentials@v5
80
77
with :
83
80
- name : Setup python
84
81
uses : actions/setup-python@v4
85
82
with :
86
- python-version : 3.12.3
83
+ python-version : 3.13.7
87
84
cache : pip
88
85
- name : Install Python dependencies
89
86
run : python3 -m pip install -r script/requirements.txt
92
89
run : |
93
90
digest=$(aws ecr describe-images \
94
91
--repository-name mavis/webapp \
95
- --image-ids imageTag=${{ inputs.git_sha_to_deploy || github.sha }} \
92
+ --image-ids imageTag=${{ steps.checkout-code.outputs.commit }} \
96
93
--query 'imageDetails[0].imageDigest' \
97
94
--output text)
98
95
echo "digest=$digest" >> $GITHUB_OUTPUT
@@ -111,13 +108,13 @@ jobs:
111
108
with :
112
109
task-definition-family : " mavis-${{ matrix.service }}-task-definition-${{ inputs.environment }}-template"
113
110
container-name : " application"
114
- image : " ${{ env.aws_account_id }}.dkr.ecr.eu-west-2.amazonaws.com/mavis/webapp@${{ steps.get-image-digest.outputs.digest }}"
111
+ image : " ${{ env.aws-account-id }}.dkr.ecr.eu-west-2.amazonaws.com/mavis/webapp@${{ steps.get-image-digest.outputs.digest }}"
115
112
environment-variables : ${{ steps.parse-environment-variables.outputs.parsed_env_vars }}
116
113
- name : Rename task definition file
117
114
run : mv ${{ steps.create-task-definition.outputs.task-definition }} ${{ runner.temp }}/${{ matrix.service }}-task-definition.json
118
115
- name : Populate SSM parameters for ${{ matrix.service }} service
119
116
run : |
120
- python3 script/populate_ssm_parameters.py ${{ inputs.environment }} ${{ matrix.service }} --app-version ${{ env.app_version }}
117
+ python3 script/populate_ssm_parameters.py ${{ inputs.environment }} ${{ matrix.service }} --app-version ${{ env.app-version }}
121
118
- name : Upload artifact for ${{ matrix.service }} task definition
122
119
uses : actions/upload-artifact@v4
123
120
with :
@@ -135,8 +132,8 @@ jobs:
135
132
deploy-web :
136
133
name : Deploy web service
137
134
runs-on : ubuntu-latest
138
- if : ${{ inputs.server_types == 'web' || inputs.server_types == 'all' }}
139
- needs : [prepare-deployment, approve-deployments]
135
+ if : ${{ inputs.server-types == 'web' || inputs.server-types == 'all' }}
136
+ needs : [ prepare-deployment, approve-deployments ]
140
137
permissions :
141
138
id-token : write
142
139
steps :
@@ -148,7 +145,7 @@ jobs:
148
145
- name : Checkout code
149
146
uses : actions/checkout@v5
150
147
- name : Download web task definition artifact
151
- uses : actions/download-artifact@v4
148
+ uses : actions/download-artifact@v5
152
149
with :
153
150
path : ${{ runner.temp }}
154
151
name : ${{ inputs.environment }}-web-task-definition
@@ -167,7 +164,7 @@ jobs:
167
164
with :
168
165
task-definition : ${{ runner.temp }}/web-task-definition.json
169
166
codedeploy-appspec : config/templates/appspec.yaml
170
- cluster : ${{ env.cluster_name }}
167
+ cluster : ${{ env.cluster-name }}
171
168
service : mavis-${{ inputs.environment }}-web
172
169
codedeploy-application : mavis-${{ inputs.environment }}
173
170
codedeploy-deployment-group : blue-green-group-${{ inputs.environment }}
@@ -180,13 +177,13 @@ jobs:
180
177
deploy-good-job :
181
178
name : Deploy good-job service
182
179
runs-on : ubuntu-latest
183
- if : ${{ inputs.server_types == 'good-job' || inputs.server_types == 'all' }}
184
- needs : [prepare-deployment, approve-deployments]
180
+ if : ${{ inputs.server-types == 'good-job' || inputs.server-types == 'all' }}
181
+ needs : [ prepare-deployment, approve-deployments ]
185
182
permissions :
186
183
id-token : write
187
184
steps :
188
185
- name : Configure AWS Credentials
189
- uses : aws-actions/configure-aws-credentials@v4
186
+ uses : aws-actions/configure-aws-credentials@v5
190
187
with :
191
188
role-to-assume : ${{ env.aws-role }}
192
189
aws-region : eu-west-2
@@ -204,16 +201,16 @@ jobs:
204
201
uses : aws-actions/amazon-ecs-deploy-task-definition@v2
205
202
with :
206
203
task-definition : ${{ runner.temp }}/good-job-task-definition.json
207
- cluster : ${{ env.cluster_name }}
204
+ cluster : ${{ env.cluster-name }}
208
205
service : mavis-${{ inputs.environment }}-good-job
209
206
force-new-deployment : true
210
207
wait-for-service-stability : true
211
208
212
209
create-sidekiq-deployment :
213
210
name : Create sidekiq deployment
214
211
runs-on : ubuntu-latest
215
- if : ${{ inputs.server_types == 'sidekiq' || inputs.server_types == 'all' }}
216
- needs : [prepare-deployment, approve-deployments]
212
+ if : ${{ inputs.server-types == 'sidekiq' || inputs.server-types == 'all' }}
213
+ needs : [ prepare-deployment, approve-deployments ]
217
214
permissions :
218
215
id-token : write
219
216
steps :
@@ -223,7 +220,7 @@ jobs:
223
220
role-to-assume : ${{ env.aws-role }}
224
221
aws-region : eu-west-2
225
222
- name : Download sidekiq task definition artifact
226
- uses : actions/download-artifact@v4
223
+ uses : actions/download-artifact@v5
227
224
with :
228
225
path : ${{ runner.temp }}
229
226
name : ${{ inputs.environment }}-sidekiq-task-definition
@@ -236,7 +233,7 @@ jobs:
236
233
uses : aws-actions/amazon-ecs-deploy-task-definition@v2
237
234
with :
238
235
task-definition : ${{ runner.temp }}/sidekiq-task-definition.json
239
- cluster : ${{ env.cluster_name }}
236
+ cluster : ${{ env.cluster-name }}
240
237
service : mavis-${{ inputs.environment }}-sidekiq
241
238
force-new-deployment : true
242
239
wait-for-service-stability : true
0 commit comments