Publish package to the Maven Central Repository #1
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: Publish package to the Maven Central Repository | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "The branch to checkout when cutting the release." | |
required: true | |
default: "central" | |
releaseVersion: | |
description: "Default version to use when preparing a release." | |
required: true | |
default: "X.Y.Z" | |
developmentVersion: | |
description: "Default version to use for new local working copy." | |
required: true | |
default: "X.Y.Z-SNAPSHOT" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Set up | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
cache: maven | |
server-id: central | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Configure git user | |
run: | | |
git config user.name "Github Actions" | |
git config user.email "[email protected]" | |
- name: Publish package | |
run: mvn -P release --batch-mode release:prepare release:perform -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} | |
env: | |
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }} |