Skip to content

Commit 9bdcc34

Browse files
committed
fix: improve version detection in push target to use latest existing tag
Fix duplicate "v" prefix issue by using git describe --abbrev=0 to get the latest existing tag instead of exact match. This prevents creating tags like "vv0.2.0" and allows the push target to work with existing tags rather than requiring exact HEAD matches. Signed-off-by: Nagy Károly Gábriel <[email protected]>
1 parent fcb75f2 commit 9bdcc34

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/build/gen_mk.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ push-$name: | release-$name ; \$(info \$(M) pushing release artifacts for $name
323323
echo "Run 'gh auth login' first" >&2; \\
324324
exit 1; \\
325325
fi
326-
\$Q VERSION="\$\$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD)"; \\
327-
RELEASE_TITLE="$name v\$\$VERSION"; \\
328-
RELEASE_TAG="v\$\$VERSION"; \\
326+
\$Q VERSION="\$\$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0-\$\$(git rev-parse --short HEAD)")"; \\
327+
case "\$\$VERSION" in v*) RELEASE_TAG="\$\$VERSION"; RELEASE_VERSION="\$\${VERSION#v}" ;; *) RELEASE_TAG="v\$\$VERSION"; RELEASE_VERSION="\$\$VERSION" ;; esac; \\
328+
RELEASE_TITLE="$name v\$\$RELEASE_VERSION"; \\
329329
echo "Creating release \$\$RELEASE_TAG..."; \\
330330
if gh release view "\$\$RELEASE_TAG" >/dev/null 2>&1; then \\
331331
echo "Release \$\$RELEASE_TAG already exists, uploading additional artifacts..."; \\

0 commit comments

Comments
 (0)