Skip to content

Deploy to central

Deploy to central #11

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Deploy to central
on: workflow_dispatch
permissions:
contents: read
jobs:
build:
name: Build
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.SIGNING_KEY }}
passphrase: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Export file
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
echo "$SIGNING_KEY" | gpg --dearmor > ~/secret_key.gpg
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Add Gradle Properties
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
echo "mavenCentralUsername=${MAVEN_CENTRAL_USERNAME}" >> gradle.properties
echo "mavenCentralPassword=${MAVEN_CENTRAL_PASSWORD}" >> gradle.properties
echo "signing.keyId=${SIGNING_KEY_ID}" >> gradle.properties
echo "signing.password=${SIGNING_KEY_PASSWORD}" >> gradle.properties
echo "signing.secretKeyRingFile=${HOME}/secret_key.gpg" >> gradle.properties
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Publish To Maven Central
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache -PmavenCentralUsername=${MAVEN_CENTRAL_USERNAME} -PmavenCentralPassword=${MAVEN_CENTRAL_PASSWORD} -Psigning.keyId=${SIGNING_KEY_ID} -Psigning.password=${SIGNING_KEY_PASSWORD} -Psigning.secretKeyRingFile=${HOME}/secret_key.gpg