Deploy to Maven Central #8
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: Deploy to Maven Central | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to publish' | |
required: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Step 1 - Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: Step 2 - Update version in pom.xml | |
run: | | |
mvn versions:set -DnewVersion=${{ github.event.inputs.version }} | |
mvn versions:commit | |
- name: Step 3 - Import GPG Key | |
run: | | |
echo "${{ secrets.GPG_PUBLIC_KEY }}" | gpg --import | |
echo "${{ secrets.GPG_SECRET_KEY }}" | gpg --import --no-tty --batch --yes | |
env: | |
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
- name: Step 4 - Set up Maven Central Repository | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
server-id: central | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Step 5 - Publish Package to Maven Central | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
run: mvn clean deploy -P release -DskipTests --batch-mode |