diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index 1d85ccc6..53dde064 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -33,36 +33,16 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Verify publication configuration - run: ./gradlew jreleaserConfig - env: - JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }} - JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} - JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} - JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Clean Build with Gradle run: ./gradlew clean build - env: - JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }} - JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} - JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} - JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} - SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - name: Publish to Maven Central Portal id: publish - run: ./gradlew publish jreleaserFullRelease --info --stacktrace -Djreleaser.verbose=true + run: ./gradlew publishToMavenCentral --no-configuration-cache env: - JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }} - JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} - JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} - JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SECRET_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSPHRASE }} GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 16c0eb9b..84676a4f 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -12,5 +12,5 @@ dependencies { implementation(libs.kotlin.serialization) implementation(libs.kotlinx.atomicfu.gradle) implementation(libs.dokka.gradle) - implementation(libs.jreleaser.gradle) -} \ No newline at end of file + implementation(libs.maven.publish) +} diff --git a/buildSrc/src/main/kotlin/mcp.jreleaser.gradle.kts b/buildSrc/src/main/kotlin/mcp.jreleaser.gradle.kts deleted file mode 100644 index 9761aa7b..00000000 --- a/buildSrc/src/main/kotlin/mcp.jreleaser.gradle.kts +++ /dev/null @@ -1,75 +0,0 @@ -import org.jreleaser.model.Active - -plugins { - id("org.jreleaser") - id("mcp.publishing") -} - -jreleaser { - gitRootSearch = true - strict = true - - signing { - active = Active.ALWAYS - armored = true - artifacts = true - files = true - } - - deploy { - active = Active.ALWAYS - maven { - active = Active.ALWAYS - mavenCentral.create("ossrh") { - active = Active.ALWAYS - sign = true - url = "https://central.sonatype.com/api/v1/publisher" - applyMavenCentralRules = false - maxRetries = 240 - stagingRepository(layout.buildDirectory.dir("staging-deploy").get().asFile.path) - - // workaround: https://github.com/jreleaser/jreleaser/issues/1784 - afterEvaluate { - publishing.publications.forEach { publication -> - if (publication is MavenPublication) { - val pubName = publication.name - - if (!pubName.contains("jvm", ignoreCase = true) - && !pubName.contains("metadata", ignoreCase = true) - && !pubName.contains("kotlinMultiplatform", ignoreCase = true) - ) { - artifactOverride { - artifactId = when { - pubName.contains("wasm", ignoreCase = true) -> - "${project.name}-wasm-${pubName.lowercase().substringAfter("wasm")}" - - else -> "${project.name}-${pubName.lowercase()}" - } - jar = false - verifyPom = false - sourceJar = false - javadocJar = false - } - } - } - } - } - } - } - - checksum { - individual = false - artifacts = false - files = false - } - } - - release { - github { - skipRelease = true - skipTag = true - overwrite = false - token = "none" - } - } -} diff --git a/buildSrc/src/main/kotlin/mcp.publishing.gradle.kts b/buildSrc/src/main/kotlin/mcp.publishing.gradle.kts index bef396de..a9b06a09 100644 --- a/buildSrc/src/main/kotlin/mcp.publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/mcp.publishing.gradle.kts @@ -1,58 +1,51 @@ plugins { `maven-publish` + id("com.vanniktech.maven.publish") signing } -val javadocJar by tasks.registering(Jar::class) { - archiveClassifier.set("javadoc") -} - -publishing { - publications.withType().configureEach { - if (name.contains("jvm", ignoreCase = true)) { - artifact(javadocJar) - } +mavenPublishing { + signAllPublications() + publishToMavenCentral(automaticRelease = true) - pom { - name = project.name - description = "Kotlin implementation of the Model Context Protocol (MCP)" - url = "https://github.com/modelcontextprotocol/kotlin-sdk" + pom { + name = project.name + description = "Kotlin implementation of the Model Context Protocol (MCP)" + url = "https://github.com/modelcontextprotocol/kotlin-sdk" - licenses { - license { - name = "MIT License" - url = "https://github.com/modelcontextprotocol/kotlin-sdk/blob/main/LICENSE" - distribution = "repo" - } + licenses { + license { + name = "MIT License" + url = "https://github.com/modelcontextprotocol/kotlin-sdk/blob/main/LICENSE" + distribution = "repo" } + } - organization { - name = "Anthropic" - url = "https://www.anthropic.com" - } + organization { + name = "Anthropic" + url = "https://www.anthropic.com" + } - developers { - developer { - id = "JetBrains" - name = "JetBrains Team" - organization = "JetBrains" - organizationUrl = "https://www.jetbrains.com" - } + developers { + developer { + id = "JetBrains" + name = "JetBrains Team" + organization = "JetBrains" + organizationUrl = "https://www.jetbrains.com" } + } - scm { - url = "https://github.com/modelcontextprotocol/kotlin-sdk" - connection = "scm:git:git://github.com/modelcontextprotocol/kotlin-sdk.git" - developerConnection = "scm:git:git@github.com:modelcontextprotocol/kotlin-sdk.git" - } + scm { + url = "https://github.com/modelcontextprotocol/kotlin-sdk" + connection = "scm:git:git://github.com/modelcontextprotocol/kotlin-sdk.git" + developerConnection = "scm:git:git@github.com:modelcontextprotocol/kotlin-sdk.git" } } +} +publishing { repositories { - maven { - name = "staging" - url = uri(layout.buildDirectory.dir("staging-deploy")) - } + mavenLocal() } } @@ -68,4 +61,4 @@ signing { useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get()) sign(publishing.publications) } -} \ No newline at end of file +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e3794978..5cbc4d2b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,8 @@ dokka = "2.0.0" atomicfu = "0.29.0" ktlint = "13.1.0" kover = "0.9.1" +mavenPublish = "0.34.0" +binaryCompatibilityValidatorPlugin = "0.18.1" # libraries version serialization = "1.9.0" @@ -13,8 +15,6 @@ coroutines = "1.10.2" kotlinx-io = "0.8.0" ktor = "3.3.0" logging = "7.0.13" -jreleaser = "1.19.0" -binaryCompatibilityValidatorPlugin = "0.18.1" slf4j = "2.0.17" kotest = "6.0.3" awaitility = "4.3.0" @@ -30,7 +30,7 @@ kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version. kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } kotlinx-atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } -jreleaser-gradle = { module = "org.jreleaser:jreleaser-gradle-plugin", version.ref = "jreleaser" } +maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "mavenPublish" } # Kotlinx libraries kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" } diff --git a/kotlin-sdk-client/build.gradle.kts b/kotlin-sdk-client/build.gradle.kts index 5da48e6b..7ba3de25 100644 --- a/kotlin-sdk-client/build.gradle.kts +++ b/kotlin-sdk-client/build.gradle.kts @@ -6,7 +6,6 @@ plugins { id("mcp.multiplatform") id("mcp.publishing") id("mcp.dokka") - id("mcp.jreleaser") alias(libs.plugins.kotlinx.binary.compatibility.validator) } diff --git a/kotlin-sdk-core/build.gradle.kts b/kotlin-sdk-core/build.gradle.kts index b87b85ad..849c841f 100644 --- a/kotlin-sdk-core/build.gradle.kts +++ b/kotlin-sdk-core/build.gradle.kts @@ -6,7 +6,6 @@ plugins { id("mcp.multiplatform") id("mcp.publishing") id("mcp.dokka") - id("mcp.jreleaser") alias(libs.plugins.kotlinx.binary.compatibility.validator) } diff --git a/kotlin-sdk-server/build.gradle.kts b/kotlin-sdk-server/build.gradle.kts index 80adddcc..c5feae0a 100644 --- a/kotlin-sdk-server/build.gradle.kts +++ b/kotlin-sdk-server/build.gradle.kts @@ -2,7 +2,6 @@ plugins { id("mcp.multiplatform") id("mcp.publishing") id("mcp.dokka") - id("mcp.jreleaser") alias(libs.plugins.kotlinx.binary.compatibility.validator) } diff --git a/kotlin-sdk/build.gradle.kts b/kotlin-sdk/build.gradle.kts index 0ac37c91..e59df60e 100644 --- a/kotlin-sdk/build.gradle.kts +++ b/kotlin-sdk/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("mcp.multiplatform") id("mcp.publishing") - id("mcp.jreleaser") } kotlin {