Publish to Maven Central #64
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
# Workflow that builds packages using Gradle and then publishes them to Maven Central OSSRH | |
# currently, it can only be triggered manually | |
name: Publish to Maven Central | |
on: workflow_dispatch | |
jobs: | |
build-and-publish: | |
strategy: | |
matrix: | |
java: ["17"] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} - JDK ${{ matrix.java }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Cache Gradle caches | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ matrix.java }}-${{ matrix.os }}-gradle-caches-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ matrix.java }}-${{ matrix.os }}-gradle-caches- | |
- name: Cache Gradle wrapper | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ matrix.java }}-${{ matrix.os }}-gradle-wrapper-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ matrix.java }}-${{ matrix.os }}-gradle-wrapper- | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v2 | |
with: | |
distribution: zulu | |
java-version: ${{ matrix.java }} | |
- name: Build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean build | |
- name: Publish | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository --info -Dorg.gradle.internal.http.socketTimeout=180000 -Dorg.gradle.internal.http.connectionTimeout=180000 | |
env: | |
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USERNAME }} | |
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }} | |
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |