feat: integrate JReleaser for automated releases #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: "Release new version and publish to the Maven Central Repository" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: maven | |
- name: Retrieve release version from tag | |
id: retrieve_release_version | |
run: release_version=${GITHUB_REF_NAME#v}; echo "release_version=$release_version" >> "$GITHUB_OUTPUT" | |
- name: Set release version | |
id: set_release_version | |
run: mvn -B versions:set -DnewVersion=${{ steps.retrieve_release_version.outputs.release_version }} && mvn help:evaluate -Dexpression=project.version -q -DforceStdout | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
message: Perform release ${{ github.event.inputs.version }} | |
- name: Release to Maven Central | |
env: | |
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }} | |
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn -B -pl spring-mvc-test-utils -Prelease jreleaser:deploy | |
- name: Set next development version | |
run: mvn -B build-helper:parse-version versions:set-property -Dproperty=revision -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} versions:commit | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
message: Set next development version | |
tags: true |