Skip to content

Commit 3707805

Browse files
committed
Simplify calculation of git sha
1 parent 8c073b9 commit 3707805

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ on:
3737
- good-job
3838
default: all
3939
git_tag:
40-
description: Git tag to deploy
40+
description: Git tag to deploy (optional). Will use workflow ref if not provided.
4141
required: false
4242
type: string
4343

@@ -53,28 +53,20 @@ jobs:
5353
ref: ${{ inputs.git_tag || github.sha }}
5454
- name: Get git sha
5555
id: get-git-sha
56-
run: |
57-
if [ -z "${{ inputs.git_tag }}" ]; then
58-
echo "No git tag provided. Using the latest commit sha"
59-
echo "git-sha=${{ github.sha }}" >> $GITHUB_OUTPUT
60-
else
61-
git_sha=$(git rev-parse refs/tags/${{ inputs.git_tag }})
62-
echo "Git tag provided. Using the sha of the tagged commit: $git_sha"
63-
echo "git-sha=$git_ssha" >> $GITHUB_OUTPUT
64-
fi
56+
run: echo "git-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
6557
build-and-push-image:
6658
needs: determine-git-sha
6759
uses: ./.github/workflows/build-and-push-image.yml
6860
with:
6961
git-sha: ${{ needs.determine-git-sha.outputs.git-sha }}
7062
deploy-infrastructure:
71-
needs: build-and-push-image
63+
needs: [build-and-push-image, determine-git-sha]
7264
uses: ./.github/workflows/deploy-infrastructure.yml
7365
with:
7466
environment: ${{ inputs.environment }}
7567
git-sha: ${{ needs.determine-git-sha.outputs.git-sha }}
7668
deploy-application:
77-
needs: deploy-infrastructure
69+
needs: [deploy-infrastructure, determine-git-sha]
7870
uses: ./.github/workflows/deploy-application.yml
7971
with:
8072
environment: ${{ inputs.environment }}

0 commit comments

Comments
 (0)