Make signing optional

This commit is contained in:
Alexander Nozik 2023-02-03 13:12:10 +03:00
parent b4fb5c515a
commit 99e3e1ea85
2 changed files with 17 additions and 12 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- MPP does not use JVM and JS(IR) targets anymore. They could be turned manually via `js()`, `jvm()` or `fullStack()` - 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 ### Deprecated

View File

@ -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")) { if (!plugins.hasPlugin("signing")) {
apply<SigningPlugin>() apply<SigningPlugin>()
} }
extensions.configure<SigningExtension>("signing") { extensions.configure<SigningExtension>("signing") {
val signingId: String? = requestPropertyOrNull("publishing.signing.id") val signingId: String? = requestPropertyOrNull("publishing.signing.id")
if (!signingId.isNullOrBlank()) { if (!signingId.isNullOrBlank()) {
val signingKey: String = requestProperty("publishing.signing.key") val signingKey: String = requestProperty("publishing.signing.key")
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase") val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
// if key is provided, use it // if key is provided, use it
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase) useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
} // else use file signing } // else use agent signing
sign(publications) sign(publications)
}
} else {
logger.warn("Signing information is not provided. Skipping artefact signing.")
} }
} }
} }