From c95dcc70b09dc0d96e009eca437c9f266f7de987 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 11 Jun 2025 16:30:08 +0100 Subject: [PATCH] Bug in the SNAPSHOT version It was generating a new version string with the name of the branch. --- .forgejo/workflows/release.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 6da4827..bf4c7d3 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -120,14 +120,21 @@ jobs: - name: Bump to next SNAPSHOT version run: | - CURRENT=$(echo "${GITHUB_REF##refs/tags/v}") - MAJOR=$(echo $CURRENT | cut -d. -f1) - MINOR=$(echo $CURRENT | cut -d. -f2) - PATCH=$(echo $CURRENT | cut -d. -f3) + # Extract the version from the ref, handling tags like v1.0.2 or branches like release/1.0.2 + RAW_REF="${GITHUB_REF##*/}" # gets 'v1.0.2' or '1.0.2' + VERSION="${RAW_REF#v}" # strips leading 'v' if present → gives '1.0.2' + + echo "Current version: $VERSION" + + MAJOR=$(echo "$VERSION" | cut -d. -f1) + MINOR=$(echo "$VERSION" | cut -d. -f2) + PATCH=$(echo "$VERSION" | cut -d. -f3) NEXT_PATCH=$((PATCH + 1)) NEXT_VERSION="$MAJOR.$MINOR.$NEXT_PATCH-SNAPSHOT" - mvn versions:set -DnewVersion=$NEXT_VERSION + echo "Next version: $NEXT_VERSION" + + mvn versions:set -DnewVersion="$NEXT_VERSION" mvn versions:commit git config user.name "forgejo-actions"