Skip to content

Commit

Permalink
SNAPSHOTs #5
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Feb 19, 2024
1 parent 48f5aee commit 8c5e9c1
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions build-logic/src/main/kotlin/internal/publishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,26 @@ internal fun Project.configurePublishing(
}
}

if (signingOptions != null) {
plugins.apply("signing")
val signing = extensions.getByType(SigningExtension::class.java)

signing.useInMemoryPgpKeys(System.getenv("GPG_KEY"), System.getenv("GPG_KEY_PASSWORD"))
signing.sign(publishing.publications)

// See https://github.com/gradle/gradle/issues/26091
tasks.withType(AbstractPublishToMaven::class.java).configureEach {
val signingTasks = tasks.withType(Sign::class.java)
it.mustRunAfter(signingTasks)
}
plugins.apply("signing")
extensions.getByType(SigningExtension::class.java).apply {
// GPG_PRIVATE_KEY should contain the armoured private key that starts with -----BEGIN PGP PRIVATE KEY BLOCK-----
// It can be obtained with gpg --armour --export-secret-keys KEY_ID
useInMemoryPgpKeys(System.getenv("GPG_KEY"), System.getenv("GPG_KEY_PASSWORD"))
sign(publishing.publications)
}

// if (signingOptions != null) {
// val signing = extensions.getByType(SigningExtension::class.java)
//
// signing.useInMemoryPgpKeys(System.getenv("GPG_KEY"), System.getenv("GPG_KEY_PASSWORD"))
// signing.sign(publishing.publications)
//
// // See https://github.com/gradle/gradle/issues/26091
// tasks.withType(AbstractPublishToMaven::class.java).configureEach {
// val signingTasks = tasks.withType(Sign::class.java)
// it.mustRunAfter(signingTasks)
// }
// }
}

/**
Expand Down

0 comments on commit 8c5e9c1

Please sign in to comment.