Skip to content

Commit 09b2903

Browse files
committed
Use git sha from input also for application deployment
* This way it's ensured that the terraform files and the docker image being deployed originate from the same commit
1 parent a710595 commit 09b2903

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/deploy-application.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ on:
3333
server_types:
3434
required: true
3535
type: string
36+
git_sha_to_deploy:
37+
description: The git commit SHA to deploy.
38+
required: true
39+
type: string
3640

3741
concurrency:
3842
group: deploy-application-${{ inputs.environment }}
@@ -52,6 +56,8 @@ jobs:
5256
steps:
5357
- name: Checkout code
5458
uses: actions/checkout@v4
59+
with:
60+
ref: ${{ inputs.git_sha_to_deploy || github.sha }}
5561
- name: Configure AWS Credentials
5662
uses: aws-actions/configure-aws-credentials@v4
5763
with:

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ on:
3636
- web
3737
- good-job
3838
default: all
39-
git_tag:
40-
description: Git tag to deploy (optional). Will use workflow ref if not provided.
41-
required: false
39+
git_ref_to_deploy:
40+
description: The Git ref to deploy, or example, a tag, branch name or commit SHA (optional). Will use workflow ref if not provided.
4241
type: string
4342

4443
jobs:
@@ -50,7 +49,7 @@ jobs:
5049
- name: Checkout code
5150
uses: actions/checkout@v4
5251
with:
53-
ref: ${{ inputs.git_tag || github.sha }}
52+
ref: ${{ inputs.git_ref_to_deploy || github.sha }}
5453
- name: Get git sha
5554
id: get-git-sha
5655
run: echo "git-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
@@ -71,3 +70,4 @@ jobs:
7170
with:
7271
environment: ${{ inputs.environment }}
7372
server_types: ${{ inputs.server_types }}
73+
git_sha_to_deploy: ${{ needs.determine-git-sha.outputs.git-sha }}

0 commit comments

Comments
 (0)