@@ -70,12 +70,41 @@ jobs:
7070
7171 - name : Resolve new release version
7272 id : release_version
73- uses : lukashornych/semantic-calendar-version@bb0a07cf0ca71a0b2b4fed52114e28092e5cac81 # v1.2.0
74- with :
75- prefix : ' v'
76- year_switch_mode : ' OnMinor'
77- minor-identifier : ' /feat(?:\\([^)]+\\))?:/'
78- hotfix-branch-pattern : ' release_.*'
73+ run : |
74+ # Check if released_version.txt exists (from workflow artifact)
75+ if [ -f "released_version.txt" ]; then
76+ VERSION=$(cat released_version.txt)
77+ echo "Using version from released_version.txt: $VERSION"
78+ echo "version=$VERSION" >> $GITHUB_OUTPUT
79+ else
80+ # Extract version from branch name (e.g., release_2025-7 -> 2025.7)
81+ BRANCH_NAME="${GITHUB_REF#refs/heads/}"
82+ echo "Branch name: $BRANCH_NAME"
83+
84+ # Extract major.minor from branch name
85+ MAJOR_MINOR=$(echo "$BRANCH_NAME" | sed 's/release_//' | sed 's/-/./')
86+ echo "Extracted major.minor: $MAJOR_MINOR"
87+
88+ # Get all tags matching this major.minor version
89+ git fetch --tags
90+ TAGS=$(git tag -l "v${MAJOR_MINOR}.*" | sort -V)
91+ echo "Found tags: $TAGS"
92+
93+ # Extract patch numbers and find the max
94+ MAX_PATCH=-1
95+ for tag in $TAGS; do
96+ PATCH=$(echo "$tag" | sed 's/.*\.//')
97+ if [ "$PATCH" -gt "$MAX_PATCH" ]; then
98+ MAX_PATCH=$PATCH
99+ fi
100+ done
101+
102+ # Increment patch number
103+ NEW_PATCH=$((MAX_PATCH + 1))
104+ VERSION="v${MAJOR_MINOR}.${NEW_PATCH}"
105+ echo "Calculated new version: $VERSION"
106+ echo "version=$VERSION" >> $GITHUB_OUTPUT
107+ fi
79108
80109 - name : Setup Java JDK
81110 uses : actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 # setup JDK 17 for building
0 commit comments