Skip to content

Deploy to Maven Central #4

Deploy to Maven Central

Deploy to Maven Central #4

Workflow file for this run

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 }} # Dynamically use branch name
- name: Step 2 - 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 3 - 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 3 - 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