Skip to content

Publish the Java Package to Maven Central #8

Publish the Java Package to Maven Central

Publish the Java Package to Maven Central #8

name: Publish the Java Package to Maven Central
on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release version (e.g. "2.1.5")'
required: true
type: string
jobs:
compile:
name: Publish the Java Package to Maven Central
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./java
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish
run: |
mvn versions:set -DnewVersion=${{ inputs.releaseVersion }}
mvn clean deploy -Prelease
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}