Skip to content

Commit 21d2c74

Browse files
committed
fix: treat blank signingKey/signingPassword as absent to avoid PGP parse error
GitHub Actions injects an empty string "" for unset secrets, not null. The previous isRequired check saw "" as non-null and called useInMemoryPgpKeys("", ...), which made Bouncy Castle blow up with 'secret key ring doesn't start with secret key tag: tag 0xffffffff'. Normalise with .ifBlank { null } before the presence check so that builds without signing secrets skip signing silently as intended.
1 parent e54b113 commit 21d2c74

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ subprojects {
113113

114114
// Signing is only wired when the developer has supplied a PGP key.
115115
// Local builds and CI without credentials skip it silently.
116+
// Note: GitHub Actions injects "" for unset secrets, so normalise
117+
// blank strings to null before the presence check.
116118
extensions.configure<org.gradle.plugins.signing.SigningExtension> {
117-
val signingKey = findProperty("signingKey") as String?
118-
?: System.getenv("GPG_SIGNING_KEY")
119-
val signingPassword = findProperty("signingPassword") as String?
120-
?: System.getenv("GPG_SIGNING_PASSWORD")
119+
val signingKey = (findProperty("signingKey") as String?)?.ifBlank { null }
120+
?: System.getenv("GPG_SIGNING_KEY")?.ifBlank { null }
121+
val signingPassword = (findProperty("signingPassword") as String?)?.ifBlank { null }
122+
?: System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null }
121123
isRequired = signingKey != null && signingPassword != null
122124
if (isRequired) {
123125
useInMemoryPgpKeys(signingKey, signingPassword)

0 commit comments

Comments
 (0)