Release To Maven Central #10
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: '0.5.0' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}" | |
- uses: actions/checkout@v4 | |
- name: Set up settings.xml for Maven Central Repository | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'zulu' | |
server-id: oss.sonatype.org | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Set projects Maven version to GitHub Action GUI set version | |
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress | |
- name: Publish package | |
run: mvn -B clean deploy --no-transfer-progress -P maven-release -DskipTests=true | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USER }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Generate changelog | |
id: changelog | |
uses: metcalfc/[email protected] | |
with: | |
myToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ github.event.inputs.releaseversion }} | |
name: Stable Release v${{ github.event.inputs.releaseversion }} | |
body: | | |
Stable Release v${{ github.event.inputs.releaseversion }} | |
${{ steps.changelog.outputs.changelog }} | |
draft: true | |
prerelease: false |