fix: use POSIX-compatible shell syntax in version script

The multiline script runs in sh, not bash. Using sed instead of
bash parameter expansion for stripping the v prefix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Barry Walker
2026-01-13 15:49:22 -05:00
parent 85aecd5b13
commit 7d17582fe7
+8 -7
View File
@@ -26,23 +26,24 @@ steps:
- name: version - name: version
image: alpine/git image: alpine/git
commands: commands:
- apk add --no-cache bash
- | - |
# Get the latest tag or default to v0.0.0 # Get the latest tag or default to v0.0.0
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "Latest tag: $LATEST_TAG" echo "Latest tag: $LATEST_TAG"
# Parse current version # Parse current version (strip 'v' prefix using sed)
VERSION=${LATEST_TAG#v} VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
MAJOR=$(echo $VERSION | cut -d. -f1) MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2) MINOR=$(echo "$VERSION" | cut -d. -f2)
PATCH=$(echo $VERSION | cut -d. -f3) PATCH=$(echo "$VERSION" | cut -d. -f3)
echo "Current: $MAJOR.$MINOR.$PATCH"
# Get commits since last tag # Get commits since last tag
if [ "$LATEST_TAG" = "v0.0.0" ]; then if [ "$LATEST_TAG" = "v0.0.0" ]; then
COMMITS=$(git log --pretty=format:"%s" HEAD) COMMITS=$(git log --pretty=format:"%s" HEAD)
else else
COMMITS=$(git log --pretty=format:"%s" ${LATEST_TAG}..HEAD) COMMITS=$(git log --pretty=format:"%s" "${LATEST_TAG}..HEAD")
fi fi
# Determine bump type from conventional commits # Determine bump type from conventional commits