Skip to content

Publish package to Central #3

Publish package to Central

Publish package to Central #3

name: Publish package to Central
on:
release:
types: [ created ]
workflow_dispatch:
concurrency:
group:
${{ github.repository }}-${{ github.workflow }}-${{ github.event.number || github.head_ref || github.run_id || github.sha }}
cancel-in-progress: true
env:
JAVA_VERSION: 8
jobs:
publish-central:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }} for publishing to Maven Central Repository
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: ./mvnw clean --batch-mode -P default,central -Dpublish=central deploy
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}