Skip to content

Commit b70457c

Browse files
chore: minor fixes on automated releases
Signed-off-by: Joris Mancini <[email protected]>
1 parent feadb3d commit b70457c

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

.github/workflows/patch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
releaseVersion:
7-
description: Patch version (vX.X)
7+
description: version to patch (vX.X)
88
required: true
99

1010
jobs:
@@ -29,7 +29,7 @@ jobs:
2929
fetch-depth: 0
3030
token: ${{ steps.app-token.outputs.token }}
3131

32-
- name: Extract tag versions
32+
- name: Parse release version
3333
run: |
3434
regex="^v([0-9]+)\.([0-9]+)$"
3535
if [[ ${{ github.event.inputs.releaseVersion }} =~ $regex ]]

.github/workflows/release.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
releaseVersion:
77
description: Release version (vX.X)
88
required: true
9-
commitSha:
10-
description: SHA of the commit from where to release
9+
gitReference:
10+
description: SHA of the commit from where to release or branch name
1111
required: true
1212

1313
jobs:
@@ -32,7 +32,7 @@ jobs:
3232
fetch-depth: 0
3333
token: ${{ steps.app-token.outputs.token }}
3434

35-
- name: Extract tag versions
35+
- name: Parse release version
3636
run: |
3737
regex="^v([0-9]+)\.([0-9]+)$"
3838
if [[ ${{ github.event.inputs.releaseVersion }} =~ $regex ]]
@@ -57,7 +57,7 @@ jobs:
5757
5858
- name: Checkout with new branch
5959
run: |
60-
git checkout -b release-v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }} ${{ github.event.inputs.commitSha }}
60+
git checkout -b release-v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }} ${{ github.event.inputs.gitReference }}
6161
6262
- name: Change Maven version to release version
6363
run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_SHORT_VERSION }}
@@ -102,24 +102,20 @@ jobs:
102102
run: |
103103
echo "CURRENT_MAVEN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
104104
105-
- name: Extract tag versions
105+
- name: Extract current version
106106
run: |
107107
regex="(.*)-SNAPSHOT"
108108
if [[ ${{ env.CURRENT_MAVEN_VERSION }} =~ $regex ]]
109109
then
110110
echo "CURRENT_RELEASE_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV
111111
fi
112112
113-
- name: Increment minor version
114-
run: |
115-
minor=${{ env.GITHUB_MINOR_VERSION }}
116-
((minor++))
117-
echo "GITHUB_MINOR_VERSION=${minor}" >> $GITHUB_ENV
118-
119113
- name: Update SNAPSHOT version on main
120114
if: env.CURRENT_RELEASE_VERSION == env.GITHUB_SHORT_VERSION
121115
run: |
122-
mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}.0-SNAPSHOT
116+
minor=${{ env.GITHUB_MINOR_VERSION }}
117+
((++minor))
118+
mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_MAJOR_VERSION }}.$minor.0-SNAPSHOT
123119
git add .
124-
git commit -m "Update SNAPSHOT version to v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}.0"
120+
git commit -m "Update SNAPSHOT version to v${{ env.GITHUB_MAJOR_VERSION }}.$minor.0"
125121
git push

0 commit comments

Comments
 (0)