Skip to content

Commit cda379e

Browse files
AJ/AS Fixed promote workflow to allow only tagged promotions
1 parent 5f7d562 commit cda379e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/cicd-4-promote.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
description: 'Environment to promote to'
88
type: environment
99
required: true
10-
release_tag:
11-
description: "The tag of the release to be promoted"
12-
required: true
1310

1411
env:
1512
AWS_REGION: eu-west-2
@@ -28,6 +25,12 @@ jobs:
2825
version: ${{ steps.variables.outputs.version }}
2926
release_tag: ${{ steps.variables.outputs.release_tag }}
3027
steps:
28+
- name: "Check ref"
29+
run: |
30+
if ${{ !startsWith(github.ref, 'refs/tags/') }}; then
31+
echo "❌ Only tagged promotions allowed."
32+
exit 1
33+
fi
3134
- name: "Checkout code"
3235
uses: actions/checkout@v5
3336
- name: "Set CI/CD variables"
@@ -39,7 +42,7 @@ jobs:
3942
echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
4043
# TODO: Get the version, but it may not be the .version file as this should come from the CI/CD Pull Request Workflow
4144
echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
42-
echo "release_tag=${{ github.event.inputs.release_tag }}" >> $GITHUB_OUTPUT
45+
echo "release_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
4346
- name: "List variables"
4447
run: |
4548
export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
@@ -54,5 +57,5 @@ jobs:
5457
uses: ./.github/workflows/stage-6-promote.yaml
5558
with:
5659
environment: ${{ inputs.environment }}
57-
release_tag: ${{ inputs.release_tag }}
60+
release_tag: ${{ needs.metadata.outputs.release_tag }}
5861
secrets: inherit

0 commit comments

Comments
 (0)