Skip to content

Commit 94478aa

Browse files
committed
build: updated build process, getting rid of semantic-calendar-version
Signed-off-by: Jan Novotný <novotnaci@gmail.com> (cherry picked from commit efa73b9)
1 parent 8ee4e5a commit 94478aa

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed

.github/workflows/ci-master.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,17 @@ 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+
# Extract version from pom.xml
75+
POM_VERSION=$(grep -m 1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
76+
echo "Extracted pom.xml version: $POM_VERSION"
77+
78+
# Remove -SNAPSHOT suffix and convert to version format with .0 patch
79+
VERSION=$(echo "$POM_VERSION" | sed 's/-SNAPSHOT$//')
80+
VERSION_WITH_PATCH="v${VERSION}.0"
81+
82+
echo "version=$VERSION_WITH_PATCH" >> $GITHUB_OUTPUT
83+
echo "Release version: $VERSION_WITH_PATCH"
7984
8085
- name: Determine release branch name
8186
id: release_branch

.github/workflows/ci-release.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)