Skip to content

Publish package to the Maven Central Repository #25

Publish package to the Maven Central Repository

Publish package to the Maven Central Repository #25

Workflow file for this run

name: Publish package to the Maven Central Repository
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Version to use for the release."
required: true
default: "X.Y.Z"
developmentVersion:
description: "Version to use for further development"
required: true
default: "X.Y.Z-SNAPSHOT"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Git User # may be removed after https://github.com/actions/checkout/issues/13 is resolved
run: |
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config user.name "${{ github.actor }}"
- name: Set up Maven
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
server-id: sonatype-nexus-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Release and publish package
run: mvn release:prepare release:perform -B -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}