Improve version tag fetching and handling in release script
This commit is contained in:
parent
f33de18007
commit
1e195a313c
@ -17,8 +17,21 @@ if ! git rev-parse --is-inside-work-tree &> /dev/null; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the latest tag or default to v0.0.0 if no tags exist
|
# Fetch all tags first to ensure we have the latest
|
||||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
printfe "%s\n" "cyan" "Fetching all tags..."
|
||||||
|
log_and_run git fetch --tags
|
||||||
|
|
||||||
|
# Get the latest version tag, excluding 'latest' tag, or default to v0.0.0 if no tags exist
|
||||||
|
VERSION_TAGS=$(git tag -l 'v*.*.*' | grep -v 'latest' | sort -V)
|
||||||
|
if [ -z "$VERSION_TAGS" ]; then
|
||||||
|
printfe "%s\n" "yellow" "No version tags found. Starting with v0.0.0."
|
||||||
|
LATEST_TAG="v0.0.0"
|
||||||
|
else
|
||||||
|
# Get the latest version tag
|
||||||
|
LATEST_TAG=$(echo "$VERSION_TAGS" | tail -n 1)
|
||||||
|
printfe "%s" "cyan" "Found latest version tag: "
|
||||||
|
printfe "%s\n" "yellow" "$LATEST_TAG" false
|
||||||
|
fi
|
||||||
|
|
||||||
# Parse the version number
|
# Parse the version number
|
||||||
if [[ $LATEST_TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
if [[ $LATEST_TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||||
@ -56,8 +69,7 @@ printfe "%s" "cyan" "Creating and pushing tag: "
|
|||||||
printfe "%s\n" "yellow" "$NEXT_VERSION" false
|
printfe "%s\n" "yellow" "$NEXT_VERSION" false
|
||||||
|
|
||||||
# Make sure we have the latest changes
|
# Make sure we have the latest changes
|
||||||
printfe "%s\n" "cyan" "Fetching latest tags..."
|
# We've already fetched tags at the beginning
|
||||||
log_and_run git fetch --tags
|
|
||||||
|
|
||||||
# Create the new tag
|
# Create the new tag
|
||||||
printfe "%s\n" "cyan" "Creating new tag..."
|
printfe "%s\n" "cyan" "Creating new tag..."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user