ci: Switch to JReleaser action for publishing artifacts #23
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: Publish package to the Maven Central Repository | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| #jobs: | |
| # publish: | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Set up Java | |
| # uses: actions/setup-java@v4 | |
| # with: | |
| # java-version: '17' | |
| # distribution: 'temurin' | |
| # - name: Publish package | |
| # 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 -Prelease deploy jreleaser:deploy -DaltDeploymentRepository=local::file:./target/staging-deploy | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Configure build steps as you'd normally do | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'temurin' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_CENTRAL_TOKEN | |
| gpg-private-key: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| cache: maven | |
| # Post JARs to Maven Central | |
| - name: Release to Maven Central | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }} | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
| run: | | |
| export GPG_TTY=$(tty) | |
| git config user.name "${{ github.event.head_commit.committer.name }}" | |
| git config user.email "${{ github.event.head_commit.committer.email }}" | |
| mvn -B --file pom.xml release:prepare release:perform | |
| # Create a release | |
| - name: Run JReleaser | |
| uses: jreleaser/release-action@v2 | |
| env: | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Persist logs | |
| - name: JReleaser release output | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jreleaser-release | |
| path: | | |
| out/jreleaser/trace.log | |
| out/jreleaser/output.properties |