Skip to content

Commit

Permalink
Further build tweaks to attempt publishing via CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tomakehurst committed Nov 9, 2023
1 parent f588616 commit 15c93fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
8 changes: 1 addition & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ task testJar(type: Jar, dependsOn: testClasses) {
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"))
!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()
Expand Down Expand Up @@ -176,8 +176,6 @@ test {
}
}

project.tasks.signMainPublication.dependsOn jar

assemble.dependsOn clean, jar

task addGitTag {
Expand All @@ -187,10 +185,6 @@ task addGitTag {
}
}

task release {
dependsOn clean, assemble, publishAllPublicationsToMavenRepository, addGitTag
}

task localRelease {
dependsOn clean, assemble, publishToMavenLocal
}
Expand Down
23 changes: 12 additions & 11 deletions wiremock-grpc-extension-standalone/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,26 @@ task testJar(type: Jar, dependsOn: testClasses) {
}

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"))
!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)
}
sign publishing.publications
}

publishing {
repositories {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
name = "GitHubPackages"
url = "https://maven.pkg.github.com/wiremock/wiremock-state-extension"
credentials {
username repoUser
password repoPassword
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
Expand All @@ -81,14 +88,8 @@ publishing {
}
}

project.tasks.signStandalonePublication.dependsOn jar

assemble.dependsOn clean, shadowJar

task release {
dependsOn clean, assemble, publishAllPublicationsToMavenRepository
}

task localRelease {
dependsOn clean, assemble, publishToMavenLocal
}
Expand Down

0 comments on commit 15c93fc

Please sign in to comment.