Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 800715f

Browse files
author
Jacek Gębal
committed
Update release process
1 parent 5b34ffe commit 800715f

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ on:
77
description: 'Release version (e.g. 3.2.3)'
88
required: true
99
next_snapshot:
10-
description: 'Next snapshot version (e.g. 3.2.4) without the "-SNAPSHOT" word'
11-
required: true
10+
description: 'Next development version (default: auto-increment patch,e.g. 3.2.4) without the "-SNAPSHOT" word'
11+
required: false
12+
13+
permissions:
14+
contents: write
15+
id-token: write
16+
attestations: write
1217

1318
defaults:
1419
run:
@@ -75,8 +80,7 @@ jobs:
7580
${{ runner.os }}-maven-
7681
7782
- name: Set release version
78-
run: |
79-
mvn versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false
83+
run: mvn versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false
8084

8185
- name: Build and test release
8286
run: mvn clean verify -Prelease
@@ -93,18 +97,21 @@ jobs:
9397

9498
- name: Commit and tag release version
9599
run: |
96-
git add -u
97-
git commit -m "chore(release): release ${{ inputs.release_version }} [skip ci]"
100+
git add pom.xml
101+
git commit -m "Release ${{ inputs.release_version }} [skip ci]"
98102
git tag -a "v${{ inputs.release_version }}" -m "Release ${{ inputs.release_version }}"
99103
100-
- name: Set next snapshot version
101-
run: |
102-
mvn versions:set -DnewVersion=${{ inputs.next_snapshot }}-SNAPSHOT -DgenerateBackupPoms=false
103-
104-
- name: Commit next snapshot version
104+
- name: Calculate and set next development version
105105
run: |
106-
git add -u
107-
git commit -m "chore(release): bump to ${{ inputs.next_snapshot }}-SNAPSHOT [skip ci]"
106+
if [[ -n "${{ inputs.next_snapshot }}" ]]; then
107+
NEXT="${{ inputs.next_snapshot }}-SNAPSHOT"
108+
else
109+
IFS='.' read -r major minor patch <<< "${{ inputs.release_version }}"
110+
NEXT="${major}.${minor}.$((patch + 1))-SNAPSHOT"
111+
fi
112+
mvn -B versions:set -DnewVersion="$NEXT" -DgenerateBackupPoms=false
113+
git add pom.xml
114+
git commit -m "Prepare next development version $NEXT [skip ci]"
108115
109116
- name: Push commits and tag
110117
run: |

0 commit comments

Comments
 (0)