Fix GitHub publish workflow #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to Sonatype | |
on: | |
push: | |
tags: | |
- '*' | |
repository_dispatch: | |
types: [publish] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
if: github.repository == 'johnsonlee/sandbox' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Publish to sonatype | |
run: | | |
echo "Create GPG private key" | |
echo $GPG_KEY_ARMOR | base64 --decode > ${GITHUB_WORKSPACE}/secring.gpg | |
echo "Publish ${GITHUB_REF} to Sonatype" | |
./gradlew clean publishToSonatype -S --no-daemon \ | |
-Pversion=${GITHUB_REF/refs\/tags\/v/} \ | |
-POSSRH_USERNAME=${OSSRH_USERNAME} \ | |
-POSSRH_PASSWORD=${OSSRH_PASSWORD} \ | |
-POSSRH_PACKAGE_GROUP=${OSSRH_PACKAGE_GROUP} \ | |
-Psigning.keyId=${GPG_KEY_ID} \ | |
-Psigning.password=${GPG_PASSPHRASE} \ | |
-Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/secring.gpg | |
./gradlew closeAndReleaseRepository -S --no-daemon \ | |
-Pversion=${GITHUB_REF/refs\/tags\/v/} \ | |
-POSSRH_USERNAME=${OSSRH_USERNAME} \ | |
-POSSRH_PASSWORD=${OSSRH_PASSWORD} \ | |
-POSSRH_PACKAGE_GROUP=${OSSRH_PACKAGE_GROUP} | |
env: | |
GPG_KEY_ARMOR: ${{ secrets.GPG_KEY_ARMOR }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PACKAGE_GROUP: ${{ secrets.OSSRH_PACKAGE_GROUP }} |