Release 1.0.0 #16
Workflow file for this run
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 | |
| # Triggered by pushing a semver tag: v1.2.3 | |
| # | |
| # Steps: | |
| # 1. Validate the tag matches the POM version (prevents accidental mismatches). | |
| # 2. Stage all artifacts to a local directory via mvn deploy. | |
| # 3. JReleaser signs the artifacts (GPG), publishes to Maven Central via the | |
| # Sonatype Central Portal, and creates a GitHub Release with changelog. | |
| # | |
| # Release workflow for maintainers: | |
| # mvn versions:set -DnewVersion=1.0.0 -DgenerateBackupPoms=false | |
| # git commit -am "Release 1.0.0" && git tag v1.0.0 && git push --tags | |
| # mvn versions:set -DnewVersion=1.1.0-SNAPSHOT -DgenerateBackupPoms=false | |
| # git commit -am "Prepare 1.1.0-SNAPSHOT" && git push | |
| # | |
| # Required repository secrets: | |
| # GPG_SECRET_KEY — armored GPG private key (-----BEGIN PGP PRIVATE KEY BLOCK-----) | |
| # GPG_PUBLIC_KEY — armored GPG public key (-----BEGIN PGP PUBLIC KEY BLOCK-----) | |
| # GPG_PASSPHRASE — passphrase protecting the GPG key | |
| # MAVENCENTRAL_USERNAME — Sonatype Central Portal username (or token username) | |
| # MAVENCENTRAL_PASSWORD — Sonatype Central Portal password (or token password) | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| permissions: | |
| contents: write # create GitHub release and upload assets | |
| jobs: | |
| release: | |
| name: Release (Java 21) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 # full history required for JReleaser changelog | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| cache: maven | |
| - name: Validate tag matches POM version | |
| run: | | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| if [ "$POM_VERSION" != "$TAG_VERSION" ]; then | |
| echo "::error::Tag $GITHUB_REF_NAME expects version $TAG_VERSION but POM has $POM_VERSION" | |
| exit 1 | |
| fi | |
| echo "RELEASE_VERSION=$TAG_VERSION" >> "$GITHUB_ENV" | |
| echo "Releasing version $POM_VERSION" | |
| - name: Stage artifacts to local directory | |
| run: mvn -B -Dmaven.test.skip=true deploy -DaltDeploymentRepository=local::file://${GITHUB_WORKSPACE}/target/staging-deploy | |
| - name: Run JReleaser | |
| uses: jreleaser/release-action@90ac653bb9c79d11179e65d81499f3f34527dcd5 # 2.5.0 | |
| with: | |
| arguments: full-release | |
| env: | |
| JRELEASER_PROJECT_VERSION: ${{ env.RELEASE_VERSION }} | |
| 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_SECRET_KEY }} | |
| JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }} | |
| - name: Upload JReleaser output | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: jreleaser-release-output | |
| path: | | |
| out/jreleaser/trace.log | |
| out/jreleaser/output.properties | |