Skip to content

Publish to specific repositories #14

Publish to specific repositories

Publish to specific repositories #14

name: Publish to specific repositories
on:
workflow_dispatch:
inputs:
MavenLocal:
description: 'Publish to MavenLocal'
required: true
default: true
type: boolean
GitHub:
description: 'Publish to GitHub'
required: true
default: false
type: boolean
OSSRH:
description: 'Publish to OSSRH'
required: true
default: false
type: boolean
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/setup-gradle
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Build
run: ./gradlew build --stacktrace
- name: Publish to MavenLocal
if: ${{ inputs.MavenLocal }}
run: ./gradlew publishAllPublicationsToMavenLocalRepository
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }}
- name: Upload Maven artifact
if: ${{ inputs.MavenLocal }}
uses: actions/upload-artifact@v4
with:
name: maven
path: build/.m2/repository
- name: Publish to GitHub
if: ${{ inputs.GitHub }}
run: ./gradlew publishAllPublicationsToGitHubRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }}
- name: Publish to OSSRH
if: ${{ inputs.OSSRH }}
run: ./gradlew publishAllPublicationsToOSSRHRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }}