Java CI with Maven #42
This file contains hidden or 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: Java CI with Maven | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Maven Central Repository | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
server-id: ossrh | |
server-username: MAVEN_USERNAME # Sonatype recommends using 'ossrh' as the username when using a token | |
server-password: MAVEN_PASSWORD # Use OSSRH token for authentication | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Debug Maven Settings | |
run: | | |
echo "Effective settings.xml:" | |
cat ~/.m2/settings.xml || echo "(none)" | |
echo "---" | |
echo "GPG version:" | |
gpg --version | |
- name: Deploy with Maven | |
run: mvn -B clean deploy -Pci-cd | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USER }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PW }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} # Token for authentication with Sonatype | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} # GPG passphrase for signing |