21
21
required : false
22
22
type : string
23
23
git_ref_to_deploy :
24
- required : true
24
+ required : false
25
25
type : string
26
26
27
27
workflow_call :
48
48
|| 'arn:aws:iam::393416225559:role/GithubDeployMavisAndInfrastructure' }}
49
49
aws_account_id : ${{ inputs.environment == 'production'
50
50
&& '820242920762' || '393416225559' }}
51
+ git_ref_to_deploy : ${{ inputs.git_ref_to_deploy || github.ref_name }}
51
52
52
53
defaults :
53
54
run :
63
64
- name : Checkout code
64
65
uses : actions/checkout@v4
65
66
with :
66
- ref : ${{ inputs.image_tag || github.sha }}
67
+ ref : ${{ env.git_ref_to_deploy }}
67
68
- name : Configure AWS Credentials
68
69
uses : aws-actions/configure-aws-credentials@v4
69
70
with :
88
89
- name : Checkout code
89
90
uses : actions/checkout@v4
90
91
with :
91
- ref : ${{ inputs.image_tag || github.sha }}
92
+ ref : ${{ env.git_ref_to_deploy }}
92
93
- name : Configure AWS Credentials
93
94
uses : aws-actions/configure-aws-credentials@v4
94
95
with :
@@ -115,7 +116,7 @@ jobs:
115
116
- name : Checkout code
116
117
uses : actions/checkout@v4
117
118
with :
118
- ref : ${{ inputs.image_tag || github.sha }}
119
+ ref : ${{ env.git_ref_to_deploy }}
119
120
- name : Configure AWS Credentials
120
121
uses : aws-actions/configure-aws-credentials@v4
121
122
with :
@@ -148,15 +149,13 @@ jobs:
148
149
run : sudo snap install --classic aws-cli
149
150
- name : Check if any deployments are running
150
151
run : ../scripts/check-for-running-deployments.sh ${{ inputs.environment }}
151
- - name : Set Mavis app version
152
- run : |
153
- echo "APP_VERSION=${{ inputs.git_ref_to_deploy }}" >> $GITHUB_ENV
154
152
- name : Terraform Plan
155
153
id : plan
156
154
run : |
157
155
set -e
158
156
terraform init -backend-config="env/${{ inputs.environment }}-backend.hcl" -upgrade
159
- terraform plan -var="image_digest=$DIGEST" -var-file="env/${{ inputs.environment }}.tfvars" \
157
+ terraform plan -var="image_digest=$DIGEST" -var="app_version=${{ env.git_ref_to_deploy }}" \
158
+ -var-file="env/${{ inputs.environment }}.tfvars" \
160
159
-out ${{ runner.temp }}/tfplan &> ${{ runner.temp }}/tf_stdout
161
160
TF_EXIT_CODE=$?
162
161
cat ${{ runner.temp }}/tf_stdout
@@ -182,7 +181,7 @@ jobs:
182
181
- name : Checkout code
183
182
uses : actions/checkout@v4
184
183
with :
185
- ref : ${{ inputs.image_tag || github.sha }}
184
+ ref : ${{ env.git_ref_to_deploy }}
186
185
- name : Configure AWS Credentials
187
186
uses : aws-actions/configure-aws-credentials@v4
188
187
with :
0 commit comments