Skip to content

Commit 5eb5371

Browse files
chore: clean main release workflow
Signed-off-by: Joris Mancini <[email protected]>
1 parent 9164cac commit 5eb5371

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@ on:
44
workflow_dispatch:
55
inputs:
66
releaseVersion:
7-
description: Release version (vX.X.X)
7+
description: Release version (vX.X)
88
required: true
99
commitSha:
1010
description: SHA of the commit from where to release
11-
required: false
12-
patch:
13-
description: Whether or not it is a patch to a previous release
14-
required: false
15-
default: 'false'
11+
required: true
1612

1713
jobs:
1814
build:
@@ -31,25 +27,18 @@ jobs:
3127

3228
- name: Extract tag versions
3329
run: |
34-
regex="v([0-9]+).([0-9]+).([0-9]+)"
30+
regex="v([0-9]+).([0-9]+)"
3531
if [[ ${{ github.event.inputs.releaseVersion }} =~ $regex ]]
3632
then
3733
echo "GITHUB_MAJOR_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV
3834
echo "GITHUB_MINOR_VERSION=${BASH_REMATCH[2]}" >> $GITHUB_ENV
39-
echo "GITHUB_PATCH_VERSION=${BASH_REMATCH[3]}" >> $GITHUB_ENV
40-
echo "GITHUB_SHORT_VERSION=${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}" >> $GITHUB_ENV
35+
echo "GITHUB_SHORT_VERSION=${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.0" >> $GITHUB_ENV
4136
fi
4237
4338
- name: Checkout with new branch
44-
if: github.event.inputs.patch == 'false'
4539
run: |
4640
git checkout -b release/v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }} ${{ github.event.inputs.commitSha }}
4741
48-
- name: Checkout on existing release branch
49-
if: github.event.inputs.patch == 'true'
50-
run: |
51-
git checkout release/v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}
52-
5342
- name: Change Maven version to release version
5443
run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_SHORT_VERSION }}
5544

@@ -58,10 +47,10 @@ jobs:
5847
git config --global user.name "github-actions[bot]"
5948
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
6049
git add .
61-
git commit -m "Release ${{ github.event.inputs.releaseVersion }}"
62-
git tag ${{ github.event.inputs.releaseVersion }}
50+
git commit -m "Release v${{ env.GITHUB_SHORT_VERSION }}"
51+
git tag v${{ env.GITHUB_SHORT_VERSION }}
6352
git push origin release/v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}
64-
git push origin ${{ github.event.inputs.releaseVersion }}
53+
git push origin v${{ env.GITHUB_SHORT_VERSION }}
6554
6655
- name: Build with Maven
6756
run: mvn --batch-mode -Pjacoco verify
@@ -85,14 +74,12 @@ jobs:
8574
-Djib.to.auth.password=${{ secrets.DOCKERHUB_TOKEN }}
8675
8776
- name: Increment minor version
88-
if: github.event.inputs.patch == 'false'
8977
run: |
9078
minor=${{ env.GITHUB_MINOR_VERSION }}
9179
((minor++))
9280
echo "GITHUB_MINOR_VERSION=${minor}" >> $GITHUB_ENV
9381
9482
- name: Update SNAPSHOT version on main
95-
if: github.event.inputs.patch == 'false'
9683
run: |
9784
git checkout main
9885
mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}.0-SNAPSHOT

0 commit comments

Comments
 (0)