diff --git a/CHANGELOG.md b/CHANGELOG.md index 88fcf47..c0ca021 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - MPP does not use JVM and JS(IR) targets anymore. They could be turned manually via `js()`, `jvm()` or `fullStack()` +- Signing is not applied if signingId is not provided ### Deprecated diff --git a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt index c3b67af..372fcf6 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt @@ -89,21 +89,25 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit } } + if (requestPropertyOrNull("publishing.signing.id") != null || requestPropertyOrNull("signing.gnupg.keyName") != null) { - if (!plugins.hasPlugin("signing")) { - apply() - } + if (!plugins.hasPlugin("signing")) { + apply() + } - extensions.configure("signing") { - val signingId: String? = requestPropertyOrNull("publishing.signing.id") - if (!signingId.isNullOrBlank()) { - val signingKey: String = requestProperty("publishing.signing.key") - val signingPassphrase: String = requestProperty("publishing.signing.passPhrase") + extensions.configure("signing") { + val signingId: String? = requestPropertyOrNull("publishing.signing.id") + if (!signingId.isNullOrBlank()) { + val signingKey: String = requestProperty("publishing.signing.key") + val signingPassphrase: String = requestProperty("publishing.signing.passPhrase") - // if key is provided, use it - useInMemoryPgpKeys(signingId, signingKey, signingPassphrase) - } // else use file signing - sign(publications) + // if key is provided, use it + useInMemoryPgpKeys(signingId, signingKey, signingPassphrase) + } // else use agent signing + sign(publications) + } + } else { + logger.warn("Signing information is not provided. Skipping artefact signing.") } } }