Skip to content

Commit e71b105

Browse files
brentragerclaude
andauthored
SMOODEV-2386: Maven Central publishing config for the Kotlin SDK (#127)
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. Claude-Session: https://claude.ai/code/session_01MPVyaZaAGgvFRUq34z4qJ8 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent a6809e6 commit e71b105

2 files changed

Lines changed: 94 additions & 1 deletion

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SMOODEV-2386: manual publish of the Kotlin SDK to Maven Central (ai.smoo).
2+
# Prereqs (one-time, Brent): Sonatype Central account + ai.smoo namespace
3+
# verification (smoo.ai DNS TXT), then repo secrets OSSRH_USERNAME /
4+
# OSSRH_PASSWORD (portal token) / MAVEN_SIGNING_KEY (ASCII-armored PGP
5+
# private key) / MAVEN_SIGNING_PASSWORD.
6+
name: Publish Kotlin SDK
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: Version to publish (e.g. 0.1.0)
12+
required: true
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 20
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-java@v4
20+
with:
21+
distribution: temurin
22+
java-version: '17'
23+
- name: Guard secrets
24+
env:
25+
U: ${{ secrets.OSSRH_USERNAME }}
26+
K: ${{ secrets.MAVEN_SIGNING_KEY }}
27+
run: |
28+
if [ -z "$U" ] || [ -z "$K" ]; then
29+
echo "::error::Maven Central secrets not configured — see SMOODEV-2386 prereqs in this workflow's header"; exit 1
30+
fi
31+
- name: Test + publish
32+
working-directory: kotlin
33+
env:
34+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
35+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
36+
MAVEN_SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }}
37+
MAVEN_SIGNING_PASSWORD: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
38+
run: |
39+
./gradlew test publish -Pversion=${{ inputs.version }} --console=plain

kotlin/build.gradle.kts

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
kotlin("jvm") version "2.1.20"
77
kotlin("plugin.serialization") version "2.1.20"
88
`maven-publish`
9+
signing
910
}
1011

1112
group = "ai.smoo"
@@ -20,6 +21,12 @@ kotlin {
2021
jvmToolchain(17)
2122
}
2223

24+
java {
25+
// Central requires -sources and -javadoc jars.
26+
withSourcesJar()
27+
withJavadocJar()
28+
}
29+
2330
dependencies {
2431
api("io.ktor:ktor-client-core:3.2.3")
2532
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
@@ -34,11 +41,58 @@ tasks.test {
3441
useJUnitPlatform()
3542
}
3643

37-
// JitPack runs `gradle publishToMavenLocal` (see /jitpack.yml).
44+
// JitPack runs `gradle publishToMavenLocal` (see /jitpack.yml). Maven Central
45+
// (SMOODEV-2386) runs `gradle publish -Pversion=<x.y.z>` from release.yml with
46+
// OSSRH_USERNAME/OSSRH_PASSWORD (Sonatype central portal token) + the signing
47+
// env vars below; all publishing metadata Central requires lives on the POM.
3848
publishing {
3949
publications {
4050
create<MavenPublication>("maven") {
4151
from(components["java"])
52+
artifactId = "smooai-config"
53+
pom {
54+
name.set("SmooAIConfig")
55+
description.set("Mobile runtime mode of @smooai/config — baked public config + live feature flags/limits for Kotlin/Android.")
56+
url.set("https://github.com/SmooAI/config")
57+
licenses {
58+
license {
59+
name.set("MIT")
60+
url.set("https://github.com/SmooAI/config/blob/main/LICENSE")
61+
}
62+
}
63+
developers {
64+
developer {
65+
id.set("smooai")
66+
name.set("Smoo AI")
67+
url.set("https://smoo.ai")
68+
}
69+
}
70+
scm {
71+
url.set("https://github.com/SmooAI/config")
72+
connection.set("scm:git:https://github.com/SmooAI/config.git")
73+
}
74+
}
75+
}
76+
}
77+
repositories {
78+
maven {
79+
name = "central"
80+
url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
81+
credentials {
82+
username = System.getenv("OSSRH_USERNAME")
83+
password = System.getenv("OSSRH_PASSWORD")
84+
}
4285
}
4386
}
4487
}
88+
89+
// Signing is REQUIRED by Central but must not break local dev / JitPack:
90+
// only sign when the key is present (CI publish path).
91+
signing {
92+
val signingKey = System.getenv("MAVEN_SIGNING_KEY")
93+
val signingPassword = System.getenv("MAVEN_SIGNING_PASSWORD")
94+
if (!signingKey.isNullOrBlank()) {
95+
useInMemoryPgpKeys(signingKey, signingPassword)
96+
sign(publishing.publications["maven"])
97+
}
98+
}

0 commit comments

Comments
 (0)