Skip to content

Publish to Maven Central #53

Publish to Maven Central

Publish to Maven Central #53

name: Publish to Maven Central
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
default: '0.0.0'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup GPG key information
run: |
echo "$GPG_SIGNING_KEY_PW" | gpg --batch --import --yes --passphrase-fd 0 <(echo -n "$GPG_SIGNING_KEY_B64" | base64 --decode)
echo -n "signing.keyId=ABC48776" >> gradle.properties
echo -n "signing.password=${GPG_SIGNING_KEY_PW}" >> gradle.properties
echo -n "signing.secretKeyRingFile=../maven.keystore" >> gradle.properties
echo "$GPG_SIGNING_KEY_PW" | gpg --batch --export-secret-keys --passphrase-fd 0 > maven.keystore
env:
GPG_SIGNING_KEY_B64: ${{ secrets.GPG_PRIVATE_KEY_B64 }}
GPG_SIGNING_KEY_PW: ${{ secrets.GPG_PASSPHRASE }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Publish package
run: ./gradlew publishToSonatype closeSonatypeStagingRepository --stacktrace --debug
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }}