Skip to content

Commit 1d9659b

Browse files
Feature/update version release workflow
2 parents feec389 + eec81fb commit 1d9659b

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Workflow: Release and publish artifacts to Maven Central
22
# Purpose: Builds, signs, and publishes Maven artifacts to Sonatype OSSRH, then tags the released version.
33
# Prerequisites: pom.xml must be on a *-SNAPSHOT version; We need to change logic for non-SNAPSHOT versions.
4-
# Notes: Adjust version computation logic if patch releases are desired instead of minor bumps (e.g., 1.2.3-SNAPSHOT to 1.3.0-SNAPSHOT).
4+
# Notes:
5+
# - release/* branches: major version increment (e.g., 1.2.3-SNAPSHOT to 2.0.0-SNAPSHOT)
6+
# - hotfix/* branches: minor version increment (e.g., 1.2.3-SNAPSHOT to 1.3.0-SNAPSHOT)
7+
# Adjust version computation logic if patch releases are desired instead of minor bumps (e.g., 1.2.3-SNAPSHOT to 1.3.0-SNAPSHOT).
58

69
name: "Release and publish artifacts to Maven Central"
710

@@ -16,6 +19,7 @@ on:
1619
push:
1720
branches:
1821
- 'release/*'
22+
- 'hotfix/*'
1923

2024
permissions:
2125
contents: write
@@ -28,10 +32,10 @@ jobs:
2832
- name: Checkout repo
2933
uses: actions/checkout@v6
3034
with:
31-
token: ${{ secrets.GITHUB_TOKEN }} # or use default GITHUB_TOKEN
32-
persist-credentials: true # allow git push from the job
33-
fetch-depth: 0 # full history so branch refs exist
34-
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} # checkout the branch (not a detached SHA)
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
persist-credentials: true
37+
fetch-depth: 0
38+
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
3539

3640
- name: Set up JDK
3741
uses: actions/setup-java@v5
@@ -69,11 +73,28 @@ jobs:
6973
TAG="v${releaseVersion}"
7074
echo "TAG=$TAG" >> $GITHUB_ENV
7175
76+
# Extract branch name
77+
BRANCH_NAME="${{ github.ref_name }}"
78+
echo "Branch name: $BRANCH_NAME"
79+
7280
# Extract numeric components for computing next development version
7381
n=${releaseVersion//[!0-9]/ }
7482
a=(${n//\./ })
75-
nextMinor=$((${a[1]} + 1))
76-
developmentVersion="${a[0]}.${nextMinor}.0-SNAPSHOT"
83+
84+
# Determine version increment based on branch name
85+
if [[ "$BRANCH_NAME" == release/* ]]; then
86+
# Major version increment for release branches
87+
nextMajor=$((${a[0]} + 1))
88+
developmentVersion="${nextMajor}.0.0-SNAPSHOT"
89+
echo "Branch type: Release - Incrementing major version: ${releaseVersion} → ${developmentVersion}"
90+
elif [[ "$BRANCH_NAME" == hotfix/* ]]; then
91+
# Minor version increment for hotfix branches
92+
currentMajor=${a[0]}
93+
nextMinor=$((${a[1]} + 1))
94+
developmentVersion="${currentMajor}.${nextMinor}.0-SNAPSHOT"
95+
echo "Branch type: Hotfix - Incrementing minor version: ${releaseVersion} → ${developmentVersion}"
96+
fi
97+
7798
echo "DEVELOPMENT_VERSION=${developmentVersion}" >> $GITHUB_ENV
7899
79100
- name: Configure GitHub authentication for Maven Release Plugin

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<groupId>org.finos.fluxnova</groupId>
77
<artifactId>fluxnova-release-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0</version>
99
<relativePath />
1010
</parent>
1111

1212
<artifactId>fluxnova-bpm-release-parent</artifactId>
13-
<version>1.1.0-SNAPSHOT</version>
13+
<version>2.0.0-SNAPSHOT</version>
1414
<packaging>pom</packaging>
1515
<name>Fluxnova Platform - Release Parent Pom</name>
1616

0 commit comments

Comments
 (0)