Skip to content

Publish to Maven Central #58

Publish to Maven Central

Publish to Maven Central #58

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)
mkdir -p ~/.gradle
echo -n "signing.keyId=ABC48776" >> ~/.gradle/gradle.properties
echo -n "signing.password=${GPG_SIGNING_KEY_PW}" >> ~/.gradle/gradle.properties
echo -n "signing.secretKeyRingFile=../maven.keystore" >> ~/.gradle/gradle.properties
echo -n "sonatypeUsername=${ORG_GRADLE_PROJECT_sonatypeUsername}" >> ~/.gradle/gradle.properties
echo -n "sonatypePassword=${ORG_GRADLE_PROJECT_sonatypePassword}" >> ~/.gradle/gradle.properties
echo -n "$GPG_SIGNING_KEY_B64" | base64 --decode > ../maven.keystore
env:
GPG_SIGNING_KEY_B64: ${{ secrets.GPG_PRIVATE_KEY_B64 }}
GPG_SIGNING_KEY_PW: ${{ secrets.GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }}
- 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