fix(ci): add debugging and fix shallow clone for version detection

- Change clone depth to partial: false
- Add explicit git fetch --tags --unshallow
- Add extensive debugging output to diagnose version detection
- Check for empty commits before pattern matching

🤖 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 19:11:32 -05:00
parent 0a3a835e08
commit 2b479a528c
+30 -8
View File
@@ -11,7 +11,7 @@ clone:
image: woodpeckerci/plugin-git image: woodpeckerci/plugin-git
settings: settings:
lfs: false lfs: false
depth: 0 # Full clone needed for version calculation partial: false
tags: true tags: true
steps: steps:
@@ -19,13 +19,24 @@ steps:
- name: calculate-version - name: calculate-version
image: alpine image: alpine
commands: commands:
- apk add --no-cache git jq - apk add --no-cache git
- | - |
set -e set -e
# Ensure we have all tags and history
echo "=== Fetching tags and history ==="
git fetch --tags --unshallow 2>/dev/null || git fetch --tags || true
git fetch origin main --unshallow 2>/dev/null || git fetch origin main || true
echo "=== Git log (last 10 commits) ==="
git log --oneline -10
echo "=== All tags ==="
git tag -l
# Get latest tag # Get latest tag
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
VERSION=$(echo "$LATEST_TAG" | sed 's/^v//') VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
@@ -41,24 +52,35 @@ steps:
COMMITS=$(git log --pretty=format:"%s" "${LATEST_TAG}..HEAD") COMMITS=$(git log --pretty=format:"%s" "${LATEST_TAG}..HEAD")
fi fi
echo "Commits since last tag:" echo "=== Commits since last tag ==="
echo "$COMMITS" echo "$COMMITS"
echo "=== End commits ==="
# Check if COMMITS is empty
if [ -z "$COMMITS" ]; then
echo "No commits found since last tag"
echo "none" > .bump-type
exit 0
fi
# Determine bump type from conventional commits # Determine bump type from conventional commits
BUMP="none" BUMP="none"
# Check for breaking changes (major bump) # Check for breaking changes (major bump)
if echo "$COMMITS" | grep -qE "^[a-z]+(\(.+\))?!:|BREAKING CHANGE:"; then if echo "$COMMITS" | grep -qE '^[a-z]+(\(.+\))?!:|BREAKING CHANGE:'; then
BUMP="major" BUMP="major"
echo "Found breaking change commit"
# Check for features (minor bump) # Check for features (minor bump)
elif echo "$COMMITS" | grep -qE "^feat(\(.+\))?:"; then elif echo "$COMMITS" | grep -qE '^feat(\(.+\))?:'; then
BUMP="minor" BUMP="minor"
echo "Found feat commit"
# Check for fixes or other conventional commits (patch bump) # Check for fixes or other conventional commits (patch bump)
elif echo "$COMMITS" | grep -qE "^(fix|perf|refactor|build|ci|docs|style|test)(\(.+\))?:"; then elif echo "$COMMITS" | grep -qE '^(fix|perf|refactor|build|ci|docs|style|test)(\(.+\))?:'; then
BUMP="patch" BUMP="patch"
echo "Found fix/patch commit"
fi fi
echo "Bump type: $BUMP" echo "=== Bump type: $BUMP ==="
# Exit if no version bump needed # Exit if no version bump needed
if [ "$BUMP" = "none" ]; then if [ "$BUMP" = "none" ]; then