|
| 1 | +/** |
| 2 | + * Zip-based Rundeck plugin publication for Maven Central (artifact uploaded as type jar). |
| 3 | + * Requires: ext.publishName, ext.githubSlug, ext.developers; task pluginZip |
| 4 | + */ |
| 5 | +apply plugin: 'maven-publish' |
| 6 | +apply plugin: 'signing' |
| 7 | + |
| 8 | +publishing { |
| 9 | + publications { |
| 10 | + mavenZip(MavenPublication) { |
| 11 | + groupId = project.group.toString() |
| 12 | + artifactId = 'yaml-text-source' |
| 13 | + version = project.version.toString() |
| 14 | + |
| 15 | + artifact(tasks.named('pluginZip')) { |
| 16 | + extension = 'jar' |
| 17 | + } |
| 18 | + |
| 19 | + pom { |
| 20 | + packaging = 'jar' |
| 21 | + name = publishName |
| 22 | + description = project.ext.hasProperty('publishDescription') ? project.ext.publishDescription : |
| 23 | + project.description ?: publishName |
| 24 | + url = "https://github.com/${githubSlug}" |
| 25 | + licenses { |
| 26 | + license { |
| 27 | + name = 'The Apache Software License, Version 2.0' |
| 28 | + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 29 | + distribution = 'repo' |
| 30 | + } |
| 31 | + } |
| 32 | + scm { |
| 33 | + url = "https://github.com/${githubSlug}" |
| 34 | + connection = "scm:git:git@github.com/${githubSlug}.git" |
| 35 | + developerConnection = "scm:git:git@github.com:${githubSlug}.git" |
| 36 | + } |
| 37 | + if (project.ext.developers) { |
| 38 | + developers { |
| 39 | + project.ext.developers.each { dev -> |
| 40 | + developer { |
| 41 | + id = dev.id |
| 42 | + name = dev.name |
| 43 | + email = dev.email |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | + repositories { |
| 52 | + def pkgcldWriteToken = System.getenv("PKGCLD_WRITE_TOKEN") ?: project.findProperty("pkgcldWriteToken") |
| 53 | + if (pkgcldWriteToken) { |
| 54 | + maven { |
| 55 | + name = "PackageCloudTest" |
| 56 | + url = uri("https://packagecloud.io/pagerduty/rundeckpro-test/maven2") |
| 57 | + authentication { |
| 58 | + header(HttpHeaderAuthentication) |
| 59 | + } |
| 60 | + credentials(HttpHeaderCredentials) { |
| 61 | + name = "Authorization" |
| 62 | + value = "Bearer " + pkgcldWriteToken |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +def base64Decode = { String prop -> |
| 70 | + project.findProperty(prop) ? |
| 71 | + new String(Base64.getDecoder().decode(project.findProperty(prop).toString())).trim() : |
| 72 | + null |
| 73 | +} |
| 74 | + |
| 75 | +if (project.hasProperty('signingKey') && project.hasProperty('signingPassword')) { |
| 76 | + signing { |
| 77 | + useInMemoryPgpKeys(base64Decode("signingKey"), project.signingPassword) |
| 78 | + sign(publishing.publications) |
| 79 | + } |
| 80 | +} |
0 commit comments