From 44067f29bb424f9f3b06524954c63287ce4aaed0 Mon Sep 17 00:00:00 2001 From: Brent Rager Date: Thu, 9 Jul 2026 16:06:28 -0400 Subject: [PATCH] SMOODEV-2386: Maven Central publishing config for the Kotlin SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Everything code-side for ai.smoo:smooai-config on Central: POM metadata (name/license/scm/developers), sources+javadoc jars, conditional PGP signing (skipped without the key so local dev and JitPack stay untouched — verified publishToMavenLocal still green), staging repo wiring, and a manual publish-kotlin workflow gated on the secrets. Remaining is account-side only: Sonatype Central account, ai.smoo namespace verification via smoo.ai DNS TXT, and four repo secrets. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01MPVyaZaAGgvFRUq34z4qJ8 --- .github/workflows/publish-kotlin.yml | 39 +++++++++++++++++++ kotlin/build.gradle.kts | 56 +++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-kotlin.yml diff --git a/.github/workflows/publish-kotlin.yml b/.github/workflows/publish-kotlin.yml new file mode 100644 index 0000000..be0d675 --- /dev/null +++ b/.github/workflows/publish-kotlin.yml @@ -0,0 +1,39 @@ +# SMOODEV-2386: manual publish of the Kotlin SDK to Maven Central (ai.smoo). +# Prereqs (one-time, Brent): Sonatype Central account + ai.smoo namespace +# verification (smoo.ai DNS TXT), then repo secrets OSSRH_USERNAME / +# OSSRH_PASSWORD (portal token) / MAVEN_SIGNING_KEY (ASCII-armored PGP +# private key) / MAVEN_SIGNING_PASSWORD. +name: Publish Kotlin SDK +on: + workflow_dispatch: + inputs: + version: + description: Version to publish (e.g. 0.1.0) + required: true +jobs: + publish: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + - name: Guard secrets + env: + U: ${{ secrets.OSSRH_USERNAME }} + K: ${{ secrets.MAVEN_SIGNING_KEY }} + run: | + if [ -z "$U" ] || [ -z "$K" ]; then + echo "::error::Maven Central secrets not configured — see SMOODEV-2386 prereqs in this workflow's header"; exit 1 + fi + - name: Test + publish + working-directory: kotlin + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }} + MAVEN_SIGNING_PASSWORD: ${{ secrets.MAVEN_SIGNING_PASSWORD }} + run: | + ./gradlew test publish -Pversion=${{ inputs.version }} --console=plain diff --git a/kotlin/build.gradle.kts b/kotlin/build.gradle.kts index 0688e95..328f417 100644 --- a/kotlin/build.gradle.kts +++ b/kotlin/build.gradle.kts @@ -6,6 +6,7 @@ plugins { kotlin("jvm") version "2.1.20" kotlin("plugin.serialization") version "2.1.20" `maven-publish` + signing } group = "ai.smoo" @@ -20,6 +21,12 @@ kotlin { jvmToolchain(17) } +java { + // Central requires -sources and -javadoc jars. + withSourcesJar() + withJavadocJar() +} + dependencies { api("io.ktor:ktor-client-core:3.2.3") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1") @@ -34,11 +41,58 @@ tasks.test { useJUnitPlatform() } -// JitPack runs `gradle publishToMavenLocal` (see /jitpack.yml). +// JitPack runs `gradle publishToMavenLocal` (see /jitpack.yml). Maven Central +// (SMOODEV-2386) runs `gradle publish -Pversion=` from release.yml with +// OSSRH_USERNAME/OSSRH_PASSWORD (Sonatype central portal token) + the signing +// env vars below; all publishing metadata Central requires lives on the POM. publishing { publications { create("maven") { from(components["java"]) + artifactId = "smooai-config" + pom { + name.set("SmooAIConfig") + description.set("Mobile runtime mode of @smooai/config — baked public config + live feature flags/limits for Kotlin/Android.") + url.set("https://github.com/SmooAI/config") + licenses { + license { + name.set("MIT") + url.set("https://github.com/SmooAI/config/blob/main/LICENSE") + } + } + developers { + developer { + id.set("smooai") + name.set("Smoo AI") + url.set("https://smoo.ai") + } + } + scm { + url.set("https://github.com/SmooAI/config") + connection.set("scm:git:https://github.com/SmooAI/config.git") + } + } + } + } + repositories { + maven { + name = "central" + url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") + credentials { + username = System.getenv("OSSRH_USERNAME") + password = System.getenv("OSSRH_PASSWORD") + } } } } + +// Signing is REQUIRED by Central but must not break local dev / JitPack: +// only sign when the key is present (CI publish path). +signing { + val signingKey = System.getenv("MAVEN_SIGNING_KEY") + val signingPassword = System.getenv("MAVEN_SIGNING_PASSWORD") + if (!signingKey.isNullOrBlank()) { + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications["maven"]) + } +}