Skip to content

Publish package to the Maven Central Repository #14

Publish package to the Maven Central Repository

Publish package to the Maven Central Repository #14

name: Publish package to the Maven Central Repository
on:
release:
types: [ created ]
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
server-password: MAVEN_PASSWORD
- id: install-secret-key
name: Install gpg secret key
run: |
echo "${{ secrets.GPG_PUBLIC_KEY }}" | gpg --import
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --import --no-tty --batch --yes
- id: publish-to-central
name: Publish to Central Repository
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
mvn \
--no-transfer-progress \
--batch-mode \
-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \
clean verify deploy