* Enable deploy. #32
Workflow file for this run
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: Publish to Maven Central | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Only triggers on version tags like v1.2.0. | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Java 21 and Maven Central credentials | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| server-id: 'central' | |
| server-username: ${{ secrets.CENTRAL_USERNAME }} | |
| server-password: ${{ secrets.CENTRAL_PASSWORD }} | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Import GPG key manually | |
| run: | | |
| echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --yes --import | |
| gpg --list-keys | |
| - name: Set GPG_TTY for batch mode | |
| run: echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | |
| - name: Configure Maven settings.xml | |
| run: | | |
| mkdir -p ~/.m2 | |
| cat > ~/.m2/settings.xml <<EOF | |
| <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
| <servers> | |
| <server> | |
| <id>central</id> | |
| <username>${{ secrets.CENTRAL_USERNAME }}</username> | |
| <password>${{ secrets.CENTRAL_PASSWORD }}</password> | |
| </server> | |
| </servers> | |
| </settings> | |
| EOF | |
| env: | |
| CENTRAL_USER_TOKEN: ${{ secrets.CENTRAL_USER_TOKEN }} | |
| - name: Publish package to Maven Central | |
| run: mvn clean deploy -Dgpg.skip=false -Dgpg.passphrase="${GPG_PASSPHRASE}" -DskipTests -B | |
| env: | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |