Skip to content

Commit 1a8770b

Browse files
committed
sanity check that input image tag matches version in container
1 parent 87b49d9 commit 1a8770b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/docker_publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ jobs:
7878
NEW_TAG=$(echo "$VERSION_OUTPUT" | sed -E 's/.*version ([0-9.]+[^ ]*).*/\1/')
7979
echo "Cleaned version: $NEW_TAG"
8080
81+
# Extract version from input image tag and validate
82+
INPUT_VERSION=$(echo "$IMAGE" | sed -E 's|.*:.*-([0-9.]+[^ ]*).*|\1|')
83+
84+
# Validate that versions match
85+
if [ "$NEW_TAG" != "$INPUT_VERSION" ]; then
86+
echo "ERROR: Version mismatch!"
87+
echo " Version from container: $NEW_TAG"
88+
echo " Version from input tag: $INPUT_VERSION"
89+
echo " Input image: $IMAGE"
90+
exit 1
91+
fi
92+
8193
# Append "-prerelease" if necessary and determine repository
8294
if [ "${{ github.event.inputs.release_environment || inputs.release_environment }}" = "staging" ]; then
8395
NEW_TAG="${NEW_TAG}-prerelease"

0 commit comments

Comments
 (0)