Skip to content

Commit c4902a5

Browse files
committed
Fix Gradle attempting to sign when not deploying
1 parent 0e91280 commit c4902a5

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright 2022, Backblaze Inc. All Rights Reserved.
2+
// License https://www.backblaze.com/using_b2_code.html
3+
14
plugins {
25
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
36
}

buildSrc/src/main/kotlin/b2sdk.gradle.kts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,20 @@ val sonatypePassword = findProperty("sonatypePassword")
146146
val gpgSigningKey = System.getenv("GPG_SIGNING_KEY")
147147
val gpgPassphrase = System.getenv("GPG_PASSPHRASE")
148148

149-
signing {
150-
setRequired {
151-
gradle.taskGraph.hasTask("publishToSonatype") || gradle.taskGraph.hasTask("createBundle")
152-
}
149+
if (sonatypeUsername != null && sonatypePassword != null) {
150+
signing {
151+
setRequired {
152+
gradle.taskGraph.hasTask("publishToSonatype") || gradle.taskGraph.hasTask("createBundle")
153+
}
153154

154-
if (gpgSigningKey != null && gpgPassphrase != null) {
155-
useInMemoryPgpKeys(gpgSigningKey, gpgPassphrase)
156-
} else {
157-
useGpgCmd()
158-
}
155+
if (gpgSigningKey != null && gpgPassphrase != null) {
156+
useInMemoryPgpKeys(gpgSigningKey, gpgPassphrase)
157+
} else {
158+
useGpgCmd()
159+
}
159160

160-
sign(publishing.publications["maven"])
161+
sign(publishing.publications["maven"])
162+
}
161163
}
162164

163165
tasks.register<Jar>("createBundle") {

0 commit comments

Comments
 (0)