Skip to content

Publish to Maven

Publish to Maven #98

Workflow file for this run

name: Publish to Maven
on:
workflow_dispatch:
inputs:
repo-gcloud:
type: boolean
description: "Repository: GCloud"
default: true
repo-mavencentral:
type: boolean
description: "Repository: Maven Central"
default: false
jobs:
build:
runs-on: ${{ matrix.os }}
env:
# See: https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secretsAdd commentMore actions
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.VARABYTE_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.VARABYTE_SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.VARABYTE_SIGNING_PASSWORD }}
strategy:
matrix:
# Note: We use macos since it can build mac, linux, and windows targets. ubuntu is faster but cannot build macAdd commentMore actions
# artifacts.
os: [macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 24
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Add secret Gradle properties
env:
GRADLE_PROPERTIES: ${{ secrets.VARABYTE_GRADLE_PROPERTIES }}
shell: bash
run: |
mkdir -p ~/.gradle/
echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV
echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties
- name: Cache Kotlin Native compiler
uses: actions/cache@v4
with:
path: ~/.konan
key: kotlin-native-compiler-${{ runner.OS }}
- name: Publish GCloud
if: inputs.repo-gcloud
run: |
./gradlew publishAllPublicationsToGCloudMavenRepository
- name: Publish Maven Central
if: inputs.repo-mavencentral
run: |
./gradlew publishAllPublicationsToMavenCentralRepository