Bug in the SNAPSHOT version
All checks were successful
Release / release (push) Successful in 20m41s

It was generating a new version string with the name of the branch.
This commit is contained in:
root 2025-06-11 16:30:08 +01:00
parent c55ef41eac
commit c95dcc70b0

View file

@ -120,14 +120,21 @@ jobs:
- name: Bump to next SNAPSHOT version - name: Bump to next SNAPSHOT version
run: | run: |
CURRENT=$(echo "${GITHUB_REF##refs/tags/v}") # Extract the version from the ref, handling tags like v1.0.2 or branches like release/1.0.2
MAJOR=$(echo $CURRENT | cut -d. -f1) RAW_REF="${GITHUB_REF##*/}" # gets 'v1.0.2' or '1.0.2'
MINOR=$(echo $CURRENT | cut -d. -f2) VERSION="${RAW_REF#v}" # strips leading 'v' if present → gives '1.0.2'
PATCH=$(echo $CURRENT | cut -d. -f3)
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_PATCH=$((PATCH + 1))
NEXT_VERSION="$MAJOR.$MINOR.$NEXT_PATCH-SNAPSHOT" 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 mvn versions:commit
git config user.name "forgejo-actions" git config user.name "forgejo-actions"