Publish Release to Maven Central #1
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 to Maven Central | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| releaseVersion: | |
| description: 'Release and tag version' | |
| required: true | |
| default: "v1.5.0-dev.N" | |
| developmentVersion: | |
| description: 'Version to use for new working copy' | |
| required: true | |
| default: '2.0.0-SNAPSHOT' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '8' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_TOKEN | |
| gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Configure Git user | |
| run: | | |
| git config user.email "actions@github.com" | |
| git config user.name "GitHub Actions" | |
| - name: Run release prepare | |
| env: | |
| RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }} | |
| DEVELOPMENT_VERSION: ${{ github.event.inputs.developmentVersion }} | |
| run: | | |
| ./mvnw release:prepare -s .maven_settings.xml -DskipTests -Darguments=-DskipTests \ | |
| -DreleaseVersion="$RELEASE_VERSION" -Dtag="$RELEASE_VERSION" \ | |
| -DdevelopmentVersion="$DEVELOPMENT_VERSION" | |
| - name: Publish to Maven Central | |
| run: | | |
| ./mvnw -B clean deploy -PsonatypeRelease -DskipTests | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USER }} | |
| MAVEN_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} |