Skip to content

Commit b1e9871

Browse files
authored
Refactor signing publications (#281)
Add a new function for signing publications ## Motivation and Context In the [latest release build](https://github.com/modelcontextprotocol/kotlin-sdk/actions/runs/17830036899/job/50692417727), the artifact signing tasks were not included ## Breaking Changes no ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [ ] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed
1 parent 77357a1 commit b1e9871

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

buildSrc/src/main/kotlin/mcp.publishing.gradle.kts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import com.vanniktech.maven.publish.MavenPublishBaseExtension
2+
13
plugins {
24
`maven-publish`
35
id("com.vanniktech.maven.publish")
@@ -6,6 +8,7 @@ plugins {
68

79
mavenPublishing {
810
publishToMavenCentral(automaticRelease = true)
11+
configureSigning(this)
912

1013
pom {
1114
name = project.name
@@ -42,13 +45,7 @@ mavenPublishing {
4245
}
4346
}
4447

45-
publishing {
46-
repositories {
47-
mavenLocal()
48-
}
49-
}
50-
51-
signing {
48+
private fun Project.configureSigning(mavenPublishing: MavenPublishBaseExtension) {
5249
val gpgKeyName = "GPG_SIGNING_KEY"
5350
val gpgPassphraseName = "SIGNING_PASSPHRASE"
5451
val signingKey = providers.environmentVariable(gpgKeyName)
@@ -57,7 +54,7 @@ signing {
5754
.orElse(providers.gradleProperty(gpgPassphraseName))
5855

5956
if (signingKey.isPresent) {
60-
useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
61-
sign(publishing.publications)
57+
mavenPublishing.signAllPublications()
58+
signing.useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
6259
}
6360
}

0 commit comments

Comments
 (0)