Skip to content

Commit 5ea40ff

Browse files
Shaurya0108Shaurya Dwivedipopematt
authored
Cleaned up signing logic and changed key formatting (#1125)
* added credential assignment using gradle -p flag * added additonal check to sign in credential and removed additional fetch from workflow * changed logging level and maintain previous if check * gradle.taskGraph.whenReady runs after the configuration phase but before task execution, ensuring the signatory is available when the signing task actually runs * Simplified code, need to change key * Added back logs for missing credentials to build.gradle.kts Co-authored-by: Matthew Pope <[email protected]> --------- Co-authored-by: Shaurya Dwivedi <[email protected]> Co-authored-by: Matthew Pope <[email protected]>
1 parent b7208ad commit 5ea40ff

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

build.gradle.kts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -626,25 +626,19 @@ signing {
626626
// if signing.keyId, signing.password, signing.secretKeyRingFile, etc are
627627
// not present in gradle.properties.
628628
isRequired = isReleaseVersion
629+
sign(publishing.publications["IonJava"])
630+
}
629631

632+
afterEvaluate {
630633
if (isCI) {
631634
val signingKeyId: String? by project
632635
val signingKey: String? by project
633636
val signingPassword: String? by project
634637

635-
logger.lifecycle("DEBUG: isCI = $isCI")
636-
logger.lifecycle("DEBUG: signingKeyId = ${if (signingKeyId.isNullOrEmpty()) "NULL/EMPTY" else "SET"}")
637-
logger.lifecycle("DEBUG: signingKey = ${if (signingKey.isNullOrEmpty()) "NULL/EMPTY" else "SET (${signingKey?.length} chars)"}")
638-
logger.lifecycle("DEBUG: signingPassword = ${if (signingPassword.isNullOrEmpty()) "NULL/EMPTY" else "SET"}")
639-
640638
if (signingKeyId.isNullOrEmpty() || signingKey.isNullOrEmpty() || signingPassword.isNullOrEmpty()) {
641-
logger.info("Skipping useInMemoryPgpKeys() due to missing credentials")
639+
logger.lifecycle("signing credentials unavailable; build artifacts will not be signed")
642640
} else {
643-
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
644-
logger.info("useInMemoryPgpKeys() called successfully")
641+
signing.useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
645642
}
646643
}
647-
648-
sign(publishing.publications["IonJava"])
649-
logger.lifecycle("DEBUG: sign() called")
650644
}

0 commit comments

Comments
 (0)