Skip to content

Maven Publish

Maven Publish #23

Workflow file for this run

# Builds the project with Maven Wrapper using the 'release' profile and publishes to Maven Central
# ---
# Add the following Github secrets from your Secret Manager
# - MAVEN_USERNAME: your Sonatype username
# - MAVEN_CENTRAL_TOKEN: an Access Token generated in your Sonatype profile
# - MAVEN_GPG_PASSPHRASE: your GPG passphrase
# - MAVEN_GPG_PRIVATE_KEY: your GPG private key
name: Maven Publish
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '17'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to Apache Maven Central
run: mvn clean deploy -B -P release
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}