Publish a release to the Maven Central Repository #12
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: Publish a release to the Maven Central Repository | |
on: | |
workflow_dispatch: | |
inputs: | |
run-ci: | |
description: Run ci and test workflows | |
required: true | |
type: boolean | |
release: | |
description: Is release? (Will update tags and version) | |
required: true | |
default: false | |
type: boolean | |
publish-version: | |
description: Published version (x.y.z) | |
required: true | |
type: string | |
next-version: | |
description: Next version (x.y.z) | |
required: true | |
type: string | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
env: | |
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.java.installations.auto-detect=false -Dorg.gradle.warning.mode=fail' | |
jobs: | |
run-publish-ci: | |
name: Run ci workflows | |
uses: ./.github/workflows/pre-publish-ci.yml | |
with: | |
run-ci: ${{ inputs.run-ci }} | |
run-ci-low-cadence: ${{ inputs.run-ci }} | |
codeql: ${{ inputs.run-ci }} | |
pre-publish: | |
name: Update version, tag repo, and return sha | |
needs: run-publish-ci | |
uses: ./.github/workflows/pre-publish.yml | |
with: | |
release: ${{ inputs.release }} | |
version: ${{ inputs.version }} | |
publish: | |
name: Publish java artifacts | |
permissions: | |
contents: write | |
packages: write | |
needs: pre-publish | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.pre-publish.outputs.sha }} | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 8 | |
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION | |
run: | | |
java -Xinternalversion | |
echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV | |
echo "BUILD_JAVA_VERSION=8" >> $GITHUB_ENV | |
- name: Publish a release | |
run: ./gradlew publish | |
env: | |
SIGNING_GPG_SECRET_KEY: ${{ secrets.signingKey }} | |
SIGNING_GPG_PASSWORD: ${{ secrets.signingPassword }} | |
OSSRH_USERNAME: ${{ secrets.ossrhUsername }} | |
OSSRH_PASSWORD: ${{ secrets.ossrhPassword }} | |
post-publish: | |
name: Update version | |
needs: publish | |
uses: ./.github/workflows/post-publish.yml | |
with: | |
release: ${{ inputs.release }} | |
version: ${{ inputs.next-version }} |