Skip to content

Publish

Publish #17

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
forceVersion:
description: 'Force version'
required: false
default: ''
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 18
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Release
if: github.ref == 'refs/heads/main'
id: release
run: |
./gradlew release \
-Prelease.customPassword=${{ github.token }} \
-Prelease.customUsername=${{ github.actor }} \
-Prelease.forceVersion=${{ github.event.inputs.forceVersion }}
echo "released_version=`./gradlew -q cV -Prelease.quiet`" >> $GITHUB_OUTPUT
- name: Publish to Maven Central
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}
- name: Create GitHub Release
if: github.ref == 'refs/heads/main' && !endsWith(steps.release.outputs.released_version, '-SNAPSHOT')
run: gh release create "${{ steps.release.outputs.released_version }}" --generate-notes
env:
GH_TOKEN: ${{ github.token }}