Skip to content

Workflow file for this run

name: Publish package to the Maven Central Repository
on:
release:
types: [published]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME # Env var that holds your OSSRH user name
server-password: MAVEN_PASSWORD # Env var that holds your OSSRH user pw
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Substituted with the value stored in the referenced secret
gpg-passphrase: SIGN_KEY_PASS # Env var that holds the key's passphrase
cache: 'maven'
- name: Build & Deploy
run: |
# -U force updates just to make sure we are using latest dependencies
# -B Batch mode (do not ask for user input), just in case
# -P activate profile
mvn -X -e -Prelease -DskipTests --batch-mode deploy
env:
SIGN_KEY_PASS: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}