Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish package to the Maven Central Repository and GitHub Packages | |
on: | |
release: | |
types: [created] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Set up Java for publishing to GitHub Packages | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- uses: s4u/[email protected] | |
with: | |
servers: | | |
[{ | |
"id": "central", | |
"username": "${{ secrets.SONATYPE_USERNAME }}", | |
"password": "${{ secrets.SONATYPE_PASSWORD }}" | |
}] | |
- if: github.event.release | |
name: Update version in pom.xml (Release only) | |
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false | |
- name: Publish to the Maven Central Repository | |
run: | | |
echo "${MAVEN_GPG_KEY}" > private_key.txt | |
gpg --import --batch private_key.txt | |
mvn --batch-mode -P release -P release-to-central deploy | |
env: | |
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
TEST_ME: $${{ vars.MAVEN_GPG_TEST }} | |
- name: Publish to GitHub Packages | |
run: mvn --batch-mode -P release -P release-to-github deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |