Skip to content

Commit

Permalink
Fixed signing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tomakehurst committed Nov 9, 2023
1 parent baf68da commit 3cbc24c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ signing {
def signingKey = providers.environmentVariable("OSSRH_GPG_SECRET_KEY").orElse("").get()
def signingPassphrase = providers.environmentVariable("OSSRH_GPG_SECRET_KEY_PASSWORD").orElse("").get()
if (!signingKey.isEmpty() && !signingPassphrase.isEmpty()) {
println "Using PGP key from env vars"
useInMemoryPgpKeys(signingKey, signingPassphrase)
} else {
println "Using default PGP key"
}

sign(publishing.publications)
Expand Down
40 changes: 21 additions & 19 deletions wiremock-grpc-extension-standalone/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ task testJar(type: Jar, dependsOn: testClasses) {
from sourceSets.test.output
}

signing {
// Docs: https://github.com/wiremock/community/blob/main/infra/maven-central.md
required {
!version.toString().contains("SNAPSHOT") && (gradle.taskGraph.hasTask("uploadArchives") || gradle.taskGraph.hasTask("publish") || gradle.taskGraph.hasTask("publishToMavenLocal"))
}
def signingKey = providers.environmentVariable("OSSRH_GPG_SECRET_KEY").orElse("").get()
def signingPassphrase = providers.environmentVariable("OSSRH_GPG_SECRET_KEY_PASSWORD").orElse("").get()
if (!signingKey.isEmpty() && !signingPassphrase.isEmpty()) {
useInMemoryPgpKeys(signingKey, signingPassphrase)
}

sign(publishing.publications)
}

jar.dependsOn 'signStandalonePublication'

publishing {
repositories {
maven {
Expand Down Expand Up @@ -91,11 +75,29 @@ publishing {
}
}

signing {
// Docs: https://github.com/wiremock/community/blob/main/infra/maven-central.md
required {
!version.toString().contains("SNAPSHOT") && (gradle.taskGraph.hasTask("uploadArchives") || gradle.taskGraph.hasTask("publish") || gradle.taskGraph.hasTask("publishToMavenLocal"))
}
def signingKey = providers.environmentVariable("OSSRH_GPG_SECRET_KEY").orElse("").get()
def signingPassphrase = providers.environmentVariable("OSSRH_GPG_SECRET_KEY_PASSWORD").orElse("").get()
if (!signingKey.isEmpty() && !signingPassphrase.isEmpty()) {
println "Using PGP key from env vars"
useInMemoryPgpKeys(signingKey, signingPassphrase)
} else {
println "Using default PGP key"
}

sign publishing.publications
}

assemble.dependsOn clean, shadowJar

publishStandalonePublicationToMavenLocal.dependsOn jar
publishStandalonePublicationToGitHubPackagesRepository.dependsOn jar
publishStandalonePublicationToSonatypeRepository.dependsOn jar
signStandalonePublication.dependsOn jar
publishStandalonePublicationToMavenLocal.dependsOn signStandalonePublication
publishStandalonePublicationToGitHubPackagesRepository.dependsOn signStandalonePublication
publishStandalonePublicationToSonatypeRepository.dependsOn signStandalonePublication


task localRelease {
Expand Down

0 comments on commit 3cbc24c

Please sign in to comment.