add maven signing #10
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 | |
on: | |
release: | |
types: [ created ] | |
push: | |
branches: | |
- main | |
- develop | |
- releases/** | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo "gh input version ${{ github.event.inputs.version }}" | |
- run: echo 'gpg fingerprint ${{ vars.GPG_SIGNING_KEY_ID }}' | |
- run: echo 'gh actor ${{ env.GITHUB_ACTOR }}' | |
- name: Setup GPG Signing Key | |
id: gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
fingerprint: ${{ vars.GPG_SIGNING_KEY_ID }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_config_global: true | |
- run: gpg -K --keyid-format LONG --with-keygrip --with-subkey-fingerprint | |
- run: git config -l --show-origin | |
- name: Setup Maven Central | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: corretto | |
cache: maven | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- run: cat ~/.m2/settings.xml | |
- name: Publish Package | |
run: mvn --batch-mode --no-transfer-progress clean deploy | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |