From 15c93fc48f8b63a82e6023411ee8ebf4b273cb1c Mon Sep 17 00:00:00 2001 From: Tom Akehurst Date: Thu, 9 Nov 2023 10:51:26 +0000 Subject: [PATCH] Further build tweaks to attempt publishing via CI --- build.gradle | 8 +------ .../build.gradle | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 7ea8f76..0857851 100644 --- a/build.gradle +++ b/build.gradle @@ -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() @@ -176,8 +176,6 @@ test { } } -project.tasks.signMainPublication.dependsOn jar - assemble.dependsOn clean, jar task addGitTag { @@ -187,10 +185,6 @@ task addGitTag { } } -task release { - dependsOn clean, assemble, publishAllPublicationsToMavenRepository, addGitTag -} - task localRelease { dependsOn clean, assemble, publishToMavenLocal } diff --git a/wiremock-grpc-extension-standalone/build.gradle b/wiremock-grpc-extension-standalone/build.gradle index b0a3549..37ff43d 100644 --- a/wiremock-grpc-extension-standalone/build.gradle +++ b/wiremock-grpc-extension-standalone/build.gradle @@ -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") } } } @@ -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 }