|
| 1 | +import com.vanniktech.maven.publish.JavadocJar |
| 2 | +import com.vanniktech.maven.publish.KotlinJvm |
| 3 | +import com.vanniktech.maven.publish.MavenPublishBaseExtension |
| 4 | +import com.vanniktech.maven.publish.SonatypeHost |
| 5 | + |
1 | 6 | plugins { |
2 | | - `maven-publish` |
3 | | - signing |
| 7 | + id("com.vanniktech.maven.publish") |
| 8 | +} |
| 9 | + |
| 10 | +publishing { |
| 11 | + repositories { |
| 12 | + if (project.hasProperty("publishLocal")) { |
| 13 | + maven { |
| 14 | + name = "LocalFileSystem" |
| 15 | + url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") |
| 16 | + } |
| 17 | + } |
| 18 | + } |
4 | 19 | } |
5 | 20 |
|
6 | | -configure<PublishingExtension> { |
7 | | - publications { |
8 | | - register<MavenPublication>("maven") { |
9 | | - from(components["java"]) |
| 21 | +repositories { |
| 22 | + gradlePluginPortal() |
| 23 | + mavenCentral() |
| 24 | +} |
10 | 25 |
|
11 | | - pom { |
12 | | - name.set("ImageKit API") |
13 | | - description.set("Checkout [API overview](/docs/api-overview) to learn about ImageKit's APIs,\nauthentication, rate limits, and error codes etc.") |
14 | | - url.set("https://imagekit.io/docs/api-reference") |
| 26 | +extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") |
| 27 | +extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") |
| 28 | +extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") |
15 | 29 |
|
16 | | - licenses { |
17 | | - license { |
18 | | - name.set("Apache-2.0") |
19 | | - } |
20 | | - } |
| 30 | +configure<MavenPublishBaseExtension> { |
| 31 | + if (!project.hasProperty("publishLocal")) { |
| 32 | + signAllPublications() |
| 33 | + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) |
| 34 | + } |
21 | 35 |
|
22 | | - developers { |
23 | | - developer { |
24 | | - name.set("Image Kit") |
25 | | - email.set("developer@imagekit.io") |
26 | | - } |
27 | | - } |
| 36 | + coordinates(project.group.toString(), project.name, project.version.toString()) |
| 37 | + configure( |
| 38 | + KotlinJvm( |
| 39 | + javadocJar = JavadocJar.Dokka("dokkaJavadoc"), |
| 40 | + sourcesJar = true, |
| 41 | + ) |
| 42 | + ) |
28 | 43 |
|
29 | | - scm { |
30 | | - connection.set("scm:git:git://github.com/imagekit-developer/imagekit-java.git") |
31 | | - developerConnection.set("scm:git:git://github.com/imagekit-developer/imagekit-java.git") |
32 | | - url.set("https://github.com/imagekit-developer/imagekit-java") |
33 | | - } |
| 44 | + pom { |
| 45 | + name.set("ImageKit API") |
| 46 | + description.set("Checkout [API overview](/docs/api-overview) to learn about ImageKit's APIs,\nauthentication, rate limits, and error codes etc.") |
| 47 | + url.set("https://imagekit.io/docs/api-reference") |
34 | 48 |
|
35 | | - versionMapping { |
36 | | - allVariants { |
37 | | - fromResolutionResult() |
38 | | - } |
39 | | - } |
| 49 | + licenses { |
| 50 | + license { |
| 51 | + name.set("Apache-2.0") |
40 | 52 | } |
41 | 53 | } |
42 | | - } |
43 | | - repositories { |
44 | | - if (project.hasProperty("publishLocal")) { |
45 | | - maven { |
46 | | - name = "LocalFileSystem" |
47 | | - url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") |
| 54 | + |
| 55 | + developers { |
| 56 | + developer { |
| 57 | + name.set("Image Kit") |
| 58 | + email.set("developer@imagekit.io") |
48 | 59 | } |
49 | 60 | } |
50 | | - } |
51 | | -} |
52 | 61 |
|
53 | | -signing { |
54 | | - val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null } |
55 | | - val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null } |
56 | | - val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null } |
57 | | - if (signingKey != null && signingPassword != null) { |
58 | | - useInMemoryPgpKeys( |
59 | | - signingKeyId, |
60 | | - signingKey, |
61 | | - signingPassword, |
62 | | - ) |
63 | | - sign(publishing.publications["maven"]) |
| 62 | + scm { |
| 63 | + connection.set("scm:git:git://github.com/imagekit-developer/imagekit-java.git") |
| 64 | + developerConnection.set("scm:git:git://github.com/imagekit-developer/imagekit-java.git") |
| 65 | + url.set("https://github.com/imagekit-developer/imagekit-java") |
| 66 | + } |
64 | 67 | } |
65 | 68 | } |
66 | 69 |
|
67 | | -tasks.named("publish") { |
68 | | - dependsOn(":closeAndReleaseSonatypeStagingRepository") |
| 70 | +tasks.withType<Zip>().configureEach { |
| 71 | + isZip64 = true |
69 | 72 | } |
0 commit comments