Release to Maven Central #19
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: Release to Maven Central | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseversion: | |
description: 'Release version' | |
required: true | |
default: 'X.X.X' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
- name: Set projects Maven version to GitHub Action GUI set version | |
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" | |
- name: Build with Maven | |
run: | | |
mvn -B clean --file pom.xml | |
mvn -B package --file pom.xml -DskipTests=true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Apache Maven Central | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
server-id: ossrh | |
server-username: ${{ secrets.OSSRH_USERNAME}} | |
server-password: ${{ secrets.OSSRH_PASSWORD }} | |
gpg-private-key: ${{ secrets.GPG_SIGN_KEY }} | |
gpg-passphrase: ${{ secrets.GPG_SIGN_PASSPHRASE }} | |
- name: Publish to Apache Maven Central | |
run: mvn -B deploy -Psign --file pom.xml | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME}} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGN_PASSPHRASE }} |