diff --git a/.woodpecker/release.yml b/.woodpecker/release.yml index 901c937..5d33443 100644 --- a/.woodpecker/release.yml +++ b/.woodpecker/release.yml @@ -27,57 +27,36 @@ steps: image: alpine/git commands: - | - # Get the latest tag or default to v0.0.0 + set -e LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") echo "Latest tag: $LATEST_TAG" - - # Parse current version (strip 'v' prefix using sed) VERSION=$(echo "$LATEST_TAG" | sed 's/^v//') MAJOR=$(echo "$VERSION" | cut -d. -f1) MINOR=$(echo "$VERSION" | cut -d. -f2) PATCH=$(echo "$VERSION" | cut -d. -f3) - echo "Current: $MAJOR.$MINOR.$PATCH" - - # Get commits since last tag if [ "$LATEST_TAG" = "v0.0.0" ]; then COMMITS=$(git log --pretty=format:"%s" HEAD) else COMMITS=$(git log --pretty=format:"%s" "${LATEST_TAG}..HEAD") fi - - # Determine bump type from conventional commits BUMP="patch" if echo "$COMMITS" | grep -qiE "^feat(\(.+\))?!:|BREAKING CHANGE:"; then BUMP="major" elif echo "$COMMITS" | grep -qiE "^feat(\(.+\))?:"; then BUMP="minor" fi - echo "Bump type: $BUMP" - - # Calculate new version case $BUMP in - major) - MAJOR=$((MAJOR + 1)) - MINOR=0 - PATCH=0 - ;; - minor) - MINOR=$((MINOR + 1)) - PATCH=0 - ;; - patch) - PATCH=$((PATCH + 1)) - ;; + major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;; + minor) MINOR=$((MINOR + 1)); PATCH=0 ;; + patch) PATCH=$((PATCH + 1)) ;; esac - - NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}" - echo "New version: $NEW_VERSION" - - # Save version for other steps - echo "$NEW_VERSION" > .version - echo "v${NEW_VERSION}" > .tag + echo "New version: $MAJOR.$MINOR.$PATCH" + echo "$MAJOR.$MINOR.$PATCH" > .version + echo "v$MAJOR.$MINOR.$PATCH" > .tag + cat .version + cat .tag depends_on: [build-and-test] # Package NuGet