@@ -3,52 +3,65 @@ import org.gradle.api.publish.maven.MavenPublication
33import org.gradle.kotlin.dsl.configure
44import org.gradle.kotlin.dsl.register
55import org.gradle.kotlin.dsl.get
6- import com.vanniktech.maven.publish.JavaLibrary
7- import com.vanniktech.maven.publish.JavadocJar
8- import com.vanniktech.maven.publish.MavenPublishBaseExtension
9- import com.vanniktech.maven.publish.SonatypeHost
106
117plugins {
12- id(" com.vanniktech.maven.publish" )
8+ `maven- publish`
9+ `signing`
1310}
1411
15- repositories {
16- gradlePluginPortal()
17- mavenCentral()
18- }
12+ configure< PublishingExtension > {
13+ publications {
14+ register< MavenPublication >( " maven " ) {
15+ from(components[ " java " ])
1916
20- extra[" signingInMemoryKey" ] = System .getenv(" GPG_SIGNING_KEY" )
21- extra[" signingInMemoryKeyId" ] = System .getenv(" GPG_SIGNING_KEY_ID" )
22- extra[" signingInMemoryKeyPassword" ] = System .getenv(" GPG_SIGNING_PASSWORD" )
17+ pom {
18+ name.set(" Openlayer API" )
19+ description.set(" API for interacting with the Openlayer server." )
20+ url.set(" https://openlayer.com/docs/api-reference/rest/overview" )
2321
24- configure<MavenPublishBaseExtension > {
25- signAllPublications()
26- publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL )
22+ licenses {
23+ license {
24+ name.set(" Apache-2.0" )
25+ }
26+ }
2727
28- this .coordinates(project.group.toString(), project.name, project.version.toString())
28+ developers {
29+ developer {
30+ name.set(" Openlayer" )
31+ 32+ }
33+ }
2934
30- pom {
31- name.set(" Openlayer API" )
32- description.set(" API for interacting with the Openlayer server." )
33- url.set(" https://openlayer.com/docs/api-reference/rest/overview" )
35+ scm {
36+ connection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
37+ developerConnection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
38+ url.set(" https://github.com/openlayer-ai/openlayer-java" )
39+ }
3440
35- licenses {
36- license {
37- name.set(" Apache-2.0" )
38- }
39- }
40-
41- developers {
42- developer {
43- name.set(" Openlayer" )
44- 41+ versionMapping {
42+ allVariants {
43+ fromResolutionResult()
44+ }
45+ }
4546 }
4647 }
48+ }
49+ }
4750
48- scm {
49- connection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
50- developerConnection.set(" scm:git:git://github.com/openlayer-ai/openlayer-java.git" )
51- url.set(" https://github.com/openlayer-ai/openlayer-java" )
52- }
51+ signing {
52+ val signingKeyId = System .getenv(" GPG_SIGNING_KEY_ID" )?.ifBlank { null }
53+ val signingKey = System .getenv(" GPG_SIGNING_KEY" )?.ifBlank { null }
54+ val signingPassword = System .getenv(" GPG_SIGNING_PASSWORD" )?.ifBlank { null }
55+ if (signingKey != null && signingPassword != null ) {
56+ useInMemoryPgpKeys(
57+ signingKeyId,
58+ signingKey,
59+ signingPassword,
60+ )
61+ sign(publishing.publications[" maven" ])
5362 }
5463}
64+
65+ tasks.named(" publish" ) {
66+ dependsOn(" :closeAndReleaseSonatypeStagingRepository" )
67+ }
0 commit comments