created a use signing flag based on branch
@@ -21,6 +21,7 @@ def versionModifier = ""
def jarVersion = "2.6.4"
def branch = System.getenv("TRAVIS_BRANCH");
def tag = System.getenv("TRAVIS_TAG");
+def useSigning = "master".equals(branch)
def getVersionName = { ->
if ("".equals(tag)) {
@@ -183,7 +184,7 @@ artifacts {
archives javadocJar, sourcesJar, examplesJar
}
-if (!version.endsWith("SNAPSHOT")) {
+if (useSigning) {
signing {
sign configurations.archives
}
@@ -232,7 +233,7 @@ publishing {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
- if (!version.endsWith("SNAPSHOT")) {
+ if (useSigning) {
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
@@ -242,7 +243,7 @@ publishing {
}
// create the signed artifacts
- if (!version.endsWith("SNAPSHOT")) {
+ if (useSigning) {
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc|examples)\.jar\.asc$/
@@ -271,6 +272,7 @@ publishing {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml")
}
+
tasks.publishMavenJavaPublicationToSonatypeRepository {
dependsOn project.tasks.signArchives
}
