diff --git a/build.gradle b/build.gradle index b50f96c..53aff69 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'io.github.mjfryc' -version '0.1.21' +version '0.1.22' repositories { mavenCentral() @@ -25,27 +25,6 @@ java { withJavadocJar() } -def hasSigningKey = System.getenv("GPG_PASSWORD") != null && System.getenv("GPG_PRIVATE_KEY") != null -if (hasSigningKey) { - System.out.println("GPG key and password found. Signing maven publications.") - doSign(project) -} else { - System.out.println("GPG key or password not found. Signing is skipped.") -} - -void doSign(Project project) { - project.signing { - required { project.gradle.taskGraph.hasTask("required") } - def signingKey = System.getenv("GPG_PRIVATE_KEY") - def signingPassword = System.getenv("GPG_PASSWORD") - useInMemoryPgpKeys(signingKey, signingPassword) - //sign configurations.archives - //sign publishing.publications.maven - sign publishing.publications.gpr - //sign project - } -} - project.plugins.withType(MavenPublishPlugin).all { PublishingExtension publishing = project.extensions.getByType(PublishingExtension) publishing.publications.withType(MavenPublication).all { mavenPublication -> @@ -105,3 +84,29 @@ publishing { } } } + +def hasSigningKey = System.getenv("GPG_PASSWORD") != null && System.getenv("GPG_PRIVATE_KEY") != null +if (hasSigningKey) { + System.out.println("GPG key and password found. Signing maven publications.") + doSign(project) +} else { + System.out.println("GPG key or password not found. Signing is skipped.") +} + +void doSign(Project project) { + println("Signing publications. All etries:") + publishing.publications.all { + println(" Publication: " + it.name) + } + + project.signing { + required { project.gradle.taskGraph.hasTask("required") } + def signingKey = System.getenv("GPG_PRIVATE_KEY") + def signingPassword = System.getenv("GPG_PASSWORD") + useInMemoryPgpKeys(signingKey, signingPassword) + //sign configurations.archives + //sign publishing.publications.maven + sign publishing.publications.gpr + //sign project + } +}