Release #3
This file contains hidden or 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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (leave empty for patch bump)' | |
| required: false | |
| type: string | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: GPG_PASSPHRASE | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Set release version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| echo "Setting version to ${{ github.event.inputs.version }}" | |
| mvn -B versions:set -DnewVersion=${{ github.event.inputs.version }} | |
| echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
| else | |
| echo "Removing -SNAPSHOT suffix for release" | |
| mvn -B versions:set -DremoveSnapshot=true | |
| RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
| echo "Release version: $RELEASE_VERSION" | |
| fi | |
| mvn -B versions:commit | |
| - name: Commit release version | |
| run: | | |
| git add pom.xml | |
| git commit -m "release: prepare release v${{ env.RELEASE_VERSION }}" | |
| - name: Build and verify | |
| run: mvn -B clean verify | |
| - name: Stage artifacts | |
| run: | | |
| mkdir -p target/staging-deploy | |
| mvn -B deploy -DaltDeploymentRepository=local::file:./target/staging-deploy -DskipTests | |
| - name: Release with JReleaser | |
| run: mvn -B jreleaser:full-release | |
| env: | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.SONATYPE_TOKEN }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Bump to next development version | |
| run: | | |
| mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT | |
| mvn -B versions:commit | |
| NEXT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| echo "Bumped to next development version: $NEXT_VERSION" | |
| - name: Commit development version | |
| run: | | |
| git add pom.xml | |
| git commit -m "release: prepare for next development iteration" | |
| - name: Push changes | |
| run: | | |
| git push origin master |