Skip to content

Workflow file for this run

name: Publish package to Maven and GitHub
on:
workflow_dispatch:
release:
types: [created]
env:
JAVA_VERSION: '21'
DISTRIBUTION: 'temurin'
jobs:
# Publish to Maven Central
publish-maven-central:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Check out the repository code
- uses: actions/checkout@v4
# Set up Maven Central Repository with GPG signing
- name: ☕ Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.DISTRIBUTION }}
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
# Publish package using the 'release' profile to exclude 'universal-coverage'
- name: 📦 Publish package
run: mvn -P central -B deploy
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
# Publish to GitHub Packages Apache Maven
publish-github-packages:
# Wait until publication is done at Maven Central, before creating the release at GitHub
needs: publish-maven-central
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
# Check out the repository code
- uses: actions/checkout@v4
# Set up
- name: ☕ Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.DISTRIBUTION }}
server-id: github
# Publish package using the 'release' profile to exclude 'universal-coverage'
- name: 📦 Publish package
run: mvn -P github -B deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}