Allow reading signing parameters from environment variables (KTI-552)
This commit is contained in:
committed by
teamcityserver
parent
fa9f0d588d
commit
bb718f2e0b
@@ -171,16 +171,18 @@ fun Project.configureDefaultPublishing() {
|
|||||||
.all { configureRepository() }
|
.all { configureRepository() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun Project.getSensitiveProperty(name: String): String? {
|
||||||
|
return project.findProperty(name) as? String ?: System.getenv(name)
|
||||||
|
}
|
||||||
|
|
||||||
private fun Project.configureSigning() {
|
private fun Project.configureSigning() {
|
||||||
configure<SigningExtension> {
|
configure<SigningExtension> {
|
||||||
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
||||||
|
|
||||||
val signKeyId = project.findProperty("signKeyId") as? String
|
val signKeyId = project.getSensitiveProperty("signKeyId")
|
||||||
if (!signKeyId.isNullOrBlank()) {
|
if (!signKeyId.isNullOrBlank()) {
|
||||||
val signKeyPrivate = project.findProperty("signKeyPrivate") as? String
|
val signKeyPrivate = project.getSensitiveProperty("signKeyPrivate") ?: error("Parameter `signKeyPrivate` not found")
|
||||||
?: error("Parameter `signKeyPrivate` not found")
|
val signKeyPassphrase = project.getSensitiveProperty("signKeyPassphrase") ?: error("Parameter `signKeyPassphrase` not found")
|
||||||
val signKeyPassphrase = project.findProperty("signKeyPassphrase") as? String
|
|
||||||
?: error("Parameter `signKeyPassphrase` not found")
|
|
||||||
useInMemoryPgpKeys(signKeyId, signKeyPrivate, signKeyPassphrase)
|
useInMemoryPgpKeys(signKeyId, signKeyPrivate, signKeyPassphrase)
|
||||||
} else {
|
} else {
|
||||||
useGpgCmd()
|
useGpgCmd()
|
||||||
|
|||||||
Reference in New Issue
Block a user