Skip to content

Commit

Permalink
Use subkeys for signing
Browse files Browse the repository at this point in the history
Requires specifying the key ID.
  • Loading branch information
ajoberstar committed Feb 18, 2024
1 parent a176ffe commit 1a18813
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ publishing {

signing {
setRequired(providers.environmentVariable("CI").orNull)
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassphrase: String? by project
useInMemoryPgpKeys(signingKey, signingPassphrase)
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassphrase)
sign(publishing.publications)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ private void configurePom(Project project, PublishingExtension publishing, Maven
private void enableSigning(Project project, SigningExtension signing, PublishingExtension publishing) {
var isCi = project.getProviders().environmentVariable("CI");

var signingKeyId = project.getProviders().gradleProperty("signingKeyId");
var signingKey = project.getProviders().gradleProperty("signingKey");
var signingPassphrase = project.getProviders().gradleProperty("signingPassphrase");

signing.setRequired(isCi.getOrNull());
signing.useInMemoryPgpKeys(signingKey.getOrNull(), signingPassphrase.getOrNull());
signing.useInMemoryPgpKeys(signingKeyId.getOrNull(), signingKey.getOrNull(), signingPassphrase.getOrNull());
signing.sign(publishing.getPublications());
}
}

0 comments on commit 1a18813

Please sign in to comment.