Skip to content

Commit 66f80f4

Browse files
committed
github nex version command fixed
1 parent 527bd5b commit 66f80f4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/scripts/get-next-version.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ set -euo pipefail
55
# Calculate the next version based on the latest git tag and output GitHub Actions variables
66
# Usage: get-next-version.sh
77

8+
# Helper to write GitHub Actions outputs (works locally too)
9+
gh_output() {
10+
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
11+
echo "$1" >> "$GITHUB_OUTPUT"
12+
fi
13+
}
14+
815
# Get the latest tag, or use v0.0.0 if no tags exist
916
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
10-
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
17+
gh_output "latest_tag=$LATEST_TAG"
1118

1219
# Extract version number and increment
1320
VERSION=$(echo $LATEST_TAG | sed 's/v//')
@@ -20,5 +27,5 @@ PATCH=${VERSION_PARTS[2]:-0}
2027
PATCH=$((PATCH + 1))
2128
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
2229

23-
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
30+
gh_output "new_version=$NEW_VERSION"
2431
echo "New version will be: $NEW_VERSION"

0 commit comments

Comments
 (0)