@@ -29,33 +29,63 @@ jobs:
2929 gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
3030 gpg-passphrase : GPG_PASSPHRASE
3131
32- - name : Release with JReleaser
32+ - name : Configure Git
33+ run : |
34+ git config user.name "github-actions[bot]"
35+ git config user.email "github-actions[bot]@users.noreply.github.com"
36+
37+ - name : Set release version
3338 run : |
34- set -e
3539 if [ -n "${{ github.event.inputs.version }}" ]; then
3640 echo "Setting version to ${{ github.event.inputs.version }}"
3741 mvn -B versions:set -DnewVersion=${{ github.event.inputs.version }}
38- mvn -B versions:commit
42+ echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
3943 else
40- echo "Auto-incrementing patch version"
41- mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}
42- mvn -B versions:commit
44+ echo "Removing -SNAPSHOT suffix for release"
45+ mvn -B versions:set -DremoveSnapshot=true
46+ RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
47+ echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
48+ echo "Release version: $RELEASE_VERSION"
4349 fi
44-
45- echo "Building and verifying..."
46- mvn -B clean verify
47-
48- echo "Staging artifacts..."
50+ mvn -B versions:commit
51+
52+ - name : Commit release version
53+ run : |
54+ git add pom.xml
55+ git commit -m "release: prepare release v${{ env.RELEASE_VERSION }}"
56+
57+ - name : Build and verify
58+ run : mvn -B clean verify
59+
60+ - name : Stage artifacts
61+ run : |
4962 mkdir -p target/staging-deploy
5063 mvn -B deploy -DaltDeploymentRepository=local::file:./target/staging-deploy -DskipTests
51-
52- echo "Releasing with JReleaser..."
53- mvn -B jreleaser:full-release
64+
65+ - name : Release with JReleaser
66+ run : mvn -B jreleaser:full-release
5467 env :
5568 JRELEASER_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5669 JRELEASER_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
5770 JRELEASER_GPG_PUBLIC_KEY : ${{ secrets.GPG_PUBLIC_KEY }}
5871 JRELEASER_GPG_SECRET_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
5972 JRELEASER_MAVENCENTRAL_USERNAME : ${{ secrets.SONATYPE_USERNAME }}
6073 JRELEASER_MAVENCENTRAL_TOKEN : ${{ secrets.SONATYPE_TOKEN }}
61- GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
74+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
75+
76+ - name : Bump to next development version
77+ run : |
78+ mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT
79+ mvn -B versions:commit
80+ NEXT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
81+ echo "Bumped to next development version: $NEXT_VERSION"
82+
83+ - name : Commit development version
84+ run : |
85+ git add pom.xml
86+ git commit -m "release: prepare for next development iteration"
87+
88+ - name : Push changes
89+ run : |
90+ git push origin master
91+ git push origin --tags
0 commit comments