Skip to content

Publish package to the GitHub Packages #4

Publish package to the GitHub Packages

Publish package to the GitHub Packages #4

Workflow file for this run

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Publish package to the GitHub Packages
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Java for publishing to GitHub Packages
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
- name: Publish to GitHub Packages
run: mvn --batch-mode deploy --file pom.xml -DGH_RELEASE=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: mvn --batch-mode deploy --file pom.xml -P central-release
env:
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
CENTRAL_USERNAME: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }}