Skip to content

Publish package to the Maven Central Repository #13

Publish package to the Maven Central Repository

Publish package to the Maven Central Repository #13

Workflow file for this run

name: Publish package to the Maven Central Repository
on:
create:
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish, for example v3.5.17'
required: true
type: string
jobs:
build:
if: (github.event_name == 'create' && github.event.ref_type == 'tag' && startsWith(github.event.ref, 'v')) || (github.event_name == 'workflow_dispatch' && startsWith(inputs.tag, 'v'))
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.event.ref }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build without tests
run: ./gradlew build -x test
- name: Publish package to Maven Central
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SECRET_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }}
run: |
./gradlew \
clean \
publishAllPublicationsToMavenCentralRepository \
--stacktrace \
--info