Maven Publish #21
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
# Builds the project with Maven Wrapper using the 'release' profile and publishes to Maven Central | |
# --- | |
# Add the following Github secrets from your Secret Manager | |
# - MAVEN_USERNAME: your Sonatype username | |
# - MAVEN_CENTRAL_TOKEN: an Access Token generated in your Sonatype profile | |
# - MAVEN_GPG_PASSPHRASE: your GPG passphrase | |
# - MAVEN_GPG_PRIVATE_KEY: your GPG private key | |
name: Maven Publish | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Publish to Apache Maven Central | |
run: mvn clean deploy -B -P release | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |