Skip to content

Workflow file for this run

name: Publish package to the Maven Central Repository and GitHub Packages
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Repository
uses: actions/checkout@v3
#To maven central
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 8
cache: maven
server-id: ossrh
#gpg is only needed for the first run
gpg-private-key: ${{ secrets.GPG_JAR_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Deploy to the Maven Central Repository
run: |
mvn -B "-Dgpg.passphrase=${{ secrets.GPG_JAR_PASSWORD }}" -P ossrh deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_JAR_PASSWORD }}
# To github packages!
- name: Set up Java for publishing to Github Packages
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 8
cache: maven
server-id: github
- name: Deploy to GitHub Packages
run: |
mvn -B -f pom.xml -Dgpg.passphrase=${{ secrets.GPG_JAR_PASSWORD }} -P github deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_JAR_PASSWORD }}