Skip to content

Commit 80bce8c

Browse files
VIA-283 AS Update workflows
- Use github.ref_name instead of parsing github.ref - Remove ability to input tag for manual deploy workflow - Update publish workflow to check for full SHA instead of SHORT_SHA
1 parent d158063 commit 80bce8c

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

.github/workflows/cicd-2-publish.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ jobs:
6363
uses: actions/checkout@v4
6464
with:
6565
fetch-depth: 0
66-
- name: "Get short SHA"
67-
id: sha
68-
run: echo "short_sha=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT
6966
- name: "Configure AWS credentials"
7067
uses: aws-actions/configure-aws-credentials@v4
7168
with:
@@ -76,12 +73,12 @@ jobs:
7673
id: copy-artefact
7774
run: |
7875
TAG=${{ github.ref_name }}
79-
SHORT_SHA=${{ steps.sha.outputs.short_sha }}
76+
SHA=${{ github.sha }}
8077
81-
if aws s3 ls "s3://${AWS_S3_ARTEFACTS_BUCKET}/sha/$SHORT_SHA/" | grep .; then
82-
aws s3 cp "s3://${AWS_S3_ARTEFACTS_BUCKET}/sha/$SHORT_SHA" "s3://${AWS_S3_RELEASES_BUCKET}/tag/$TAG/" --recursive
78+
if aws s3 ls "s3://${AWS_S3_ARTEFACTS_BUCKET}/sha/$SHA/" | grep .; then
79+
aws s3 cp "s3://${AWS_S3_ARTEFACTS_BUCKET}/sha/$SHA" "s3://${AWS_S3_RELEASES_BUCKET}/tag/$TAG/" --recursive
8380
else
84-
echo "Error: No build found for SHA: $SHORT_SHA"
81+
echo "Error: No build found for SHA: $SHA"
8582
exit 1
8683
fi
8784
- name: "Get commit history"

.github/workflows/cicd-3-deploy.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
description: 'Environment to deploy to'
88
type: environment
99
required: true
10-
tag:
11-
description: "The commit SHA (DEV) or version tag (higher envs) to be deployed"
12-
required: true
1310

1411
env:
1512
AWS_REGION: eu-west-2
@@ -32,7 +29,7 @@ jobs:
3229
- name: "Checkout code"
3330
uses: actions/checkout@v4
3431
with:
35-
ref: ${{ github.event.inputs.tag }}
32+
ref: ${{ github.ref }}
3633
- name: "Set CI/CD variables"
3734
id: variables
3835
run: |
@@ -45,7 +42,7 @@ jobs:
4542
echo "terraform_version=$(grep "^terraform" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
4643
# TODO: Get the version, but it may not be the .version file as this should come from the CI/CD Pull Request Workflow
4744
echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
48-
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
45+
echo "tag=${{ github.ref_name }})" >> $GITHUB_OUTPUT
4946
- name: "List variables"
5047
run: |
5148
export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"

.github/workflows/stage-4-deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
type: string
99
tag:
1010
description: "The commit SHA (DEV) or version tag (higher envs) to be deployed"
11-
required: false
11+
required: true
1212
type: string
1313
environment:
1414
description: "Environment to deploy to"
@@ -17,7 +17,7 @@ on:
1717

1818
env:
1919
AWS_REGION: eu-west-2
20-
TAG: ${{ inputs.tag || github.sha }}
20+
TAG: ${{ inputs.tag }}
2121

2222
jobs:
2323
deploy:

0 commit comments

Comments
 (0)