Release To Maven Central #13
This file contains hidden or 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: | |
branch: | |
description: 'Branch to build' | |
required: true | |
default: 'main' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Check branch | |
if: ${{ github.event.inputs.branch != 'main' }} | |
run: | | |
echo "This workflow can only be run on the main branch." | |
exit 1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. | |
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
- name: Build with Gradle Wrapper | |
run: ./gradlew uploadToMavenCentral | |
env: | |
MAVEN_CENTRAL_USERNAME: ${{ secrets.MavenCentralUsername }} | |
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MavenCentralPassword }} | |
GPG_SIGNING_SECRET_KEY: ${{ secrets.GpgSigningSecretKey }} | |
GPG_SIGNING_PASSWORD: ${{ secrets.GpgSigningPassword }} | |