Skip to content

Commit 8ae507c

Browse files
fletcher.fanclaude
andcommitted
Feat: Add semver validation for release tag input
Validate that the tag matches vX.Y.Z format before building and pushing Docker image, to prevent accidental publishes. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent cd7fba4 commit 8ae507c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/docker_release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ jobs:
4343
id: meta
4444
run: |
4545
TAG="${{ inputs.tag || github.ref_name }}"
46-
VERSION=$(echo "$TAG" | sed -e 's/^v//')
46+
if ! [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
47+
echo "Invalid release tag: $TAG (expected e.g. v0.5.0)"
48+
exit 1
49+
fi
50+
VERSION="${TAG#v}"
4751
COMMIT=$(git rev-parse HEAD)
4852
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
4953
echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)