Skip to content

Commit 1a8d4e6

Browse files
committed
chore: Check release tagging to verify whether it's a tag or non-tag trigger
1 parent 460c8e4 commit 1a8d4e6

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,26 @@ jobs:
3939
exit 1
4040
fi
4141
42-
# Extract git tag from GITHUB_REF_NAME (e.g., "v0.8.10")
43-
GIT_TAG="${GITHUB_REF_NAME}"
44-
45-
# Validate that git tag matches mix.exs version
46-
# Git tag should be v<version>, so strip the 'v' prefix for comparison
47-
TAG_VERSION="${GIT_TAG#v}"
48-
49-
if [ "$VERSION" != "$TAG_VERSION" ]; then
50-
echo "::error::Version mismatch: mix.exs version is '$VERSION' but git tag is '$GIT_TAG' (without 'v': '$TAG_VERSION')"
51-
exit 1
42+
# Check if this is a tag push or workflow_dispatch
43+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
44+
# Extract git tag from GITHUB_REF_NAME (e.g., "v0.8.10")
45+
GIT_TAG="${GITHUB_REF_NAME}"
46+
47+
# Validate that git tag matches mix.exs version
48+
# Git tag should be v<version>, so strip the 'v' prefix for comparison
49+
TAG_VERSION="${GIT_TAG#v}"
50+
51+
if [ "$VERSION" != "$TAG_VERSION" ]; then
52+
echo "::error::Version mismatch: mix.exs version is '$VERSION' but git tag is '$GIT_TAG' (without 'v': '$TAG_VERSION')"
53+
exit 1
54+
fi
55+
56+
echo "✓ Version validation passed: mix.exs version '$VERSION' matches git tag '$GIT_TAG'"
57+
else
58+
# workflow_dispatch or other non-tag trigger
59+
echo "ℹ Using version from mix.exs: '$VERSION' (not a tag push)"
5260
fi
5361
54-
echo "✓ Version validation passed: mix.exs version '$VERSION' matches git tag '$GIT_TAG'"
5562
echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV
5663
5764
- name: Install Rust toolchain

0 commit comments

Comments
 (0)