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:
+30
-8
@@ -11,7 +11,7 @@ clone:
|
||||
image: woodpeckerci/plugin-git
|
||||
settings:
|
||||
lfs: false
|
||||
depth: 0 # Full clone needed for version calculation
|
||||
partial: false
|
||||
tags: true
|
||||
|
||||
steps:
|
||||
@@ -19,13 +19,24 @@ steps:
|
||||
- name: calculate-version
|
||||
image: alpine
|
||||
commands:
|
||||
- apk add --no-cache git jq
|
||||
- apk add --no-cache git
|
||||
- |
|
||||
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
|
||||
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
|
||||
VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
|
||||
@@ -41,24 +52,35 @@ steps:
|
||||
COMMITS=$(git log --pretty=format:"%s" "${LATEST_TAG}..HEAD")
|
||||
fi
|
||||
|
||||
echo "Commits since last tag:"
|
||||
echo "=== Commits since last tag ==="
|
||||
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
|
||||
BUMP="none"
|
||||
|
||||
# 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"
|
||||
echo "Found breaking change commit"
|
||||
# Check for features (minor bump)
|
||||
elif echo "$COMMITS" | grep -qE "^feat(\(.+\))?:"; then
|
||||
elif echo "$COMMITS" | grep -qE '^feat(\(.+\))?:'; then
|
||||
BUMP="minor"
|
||||
echo "Found feat commit"
|
||||
# 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"
|
||||
echo "Found fix/patch commit"
|
||||
fi
|
||||
|
||||
echo "Bump type: $BUMP"
|
||||
echo "=== Bump type: $BUMP ==="
|
||||
|
||||
# Exit if no version bump needed
|
||||
if [ "$BUMP" = "none" ]; then
|
||||
|
||||
Reference in New Issue
Block a user