Skip to content

Commit ae0345d

Browse files
feat(api): update via SDK Studio (#5)
1 parent bd57b46 commit ae0345d

6 files changed

+46
-70
lines changed

.github/workflows/publish-sonatype.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
- name: Publish to Sonatype
3232
run: |
33-
./gradlew --parallel --no-daemon publish
33+
./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD"
3434
env:
3535
SONATYPE_USERNAME: ${{ secrets.OPENLAYER_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
3636
SONATYPE_PASSWORD: ${{ secrets.OPENLAYER_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}

build.gradle.kts

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
plugins {
2-
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
2+
33
}
44

55
allprojects {
66
group = "org.openlayer"
77
version = "0.1.0-alpha.1" // x-release-please-version
88
}
99

10-
nexusPublishing {
11-
repositories {
12-
sonatype {
13-
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
14-
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
1510

16-
username.set(System.getenv("SONATYPE_USERNAME"))
17-
password.set(System.getenv("SONATYPE_PASSWORD"))
18-
}
19-
}
20-
}

buildSrc/build.gradle.kts

+4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
plugins {
22
`kotlin-dsl`
3+
kotlin("jvm") version "1.9.22"
4+
id("com.vanniktech.maven.publish") version "0.28.0"
35
}
46

57
repositories {
68
gradlePluginPortal()
9+
mavenCentral()
710
}
811

912
dependencies {
1013
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
1114
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
15+
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
1216
}

buildSrc/src/main/kotlin/openlayer.java.gradle.kts

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import com.diffplug.gradle.spotless.SpotlessExtension
22
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
3-
import java.util.Locale
3+
import com.vanniktech.maven.publish.JavaLibrary
4+
import com.vanniktech.maven.publish.JavadocJar
5+
import com.vanniktech.maven.publish.MavenPublishBaseExtension
6+
import com.vanniktech.maven.publish.SonatypeHost
47

58
plugins {
69
`java-library`
@@ -11,11 +14,6 @@ repositories {
1114
mavenCentral()
1215
}
1316

14-
configure<JavaPluginExtension> {
15-
withJavadocJar()
16-
withSourcesJar()
17-
}
18-
1917
configure<SpotlessExtension> {
2018
java {
2119
importOrder()
@@ -35,10 +33,6 @@ tasks.withType<JavaCompile>().configureEach {
3533
options.release.set(8)
3634
}
3735

38-
tasks.named<Jar>("javadocJar") {
39-
setZip64(true)
40-
}
41-
4236
tasks.named<Jar>("jar") {
4337
manifest {
4438
attributes(mapOf(

buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import com.diffplug.gradle.spotless.SpotlessExtension
22
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
import com.vanniktech.maven.publish.*
34

45
plugins {
56
id("openlayer.java")

buildSrc/src/main/kotlin/openlayer.publish.gradle.kts

+35-48
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,52 @@ import org.gradle.api.publish.maven.MavenPublication
33
import org.gradle.kotlin.dsl.configure
44
import org.gradle.kotlin.dsl.register
55
import 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
610

711
plugins {
8-
`maven-publish`
9-
`signing`
12+
id("com.vanniktech.maven.publish")
1013
}
1114

12-
configure<PublishingExtension> {
13-
publications {
14-
register<MavenPublication>("maven") {
15-
from(components["java"])
15+
repositories {
16+
gradlePluginPortal()
17+
mavenCentral()
18+
}
1619

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")
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")
2123

22-
licenses {
23-
license {
24-
name.set("Apache-2.0")
25-
}
26-
}
24+
configure<MavenPublishBaseExtension> {
25+
signAllPublications()
26+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
2727

28-
developers {
29-
developer {
30-
name.set("Openlayer")
31-
email.set("[email protected]")
32-
}
33-
}
28+
this.coordinates(project.group.toString(), project.name, project.version.toString())
3429

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-
}
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")
4034

41-
versionMapping {
42-
allVariants {
43-
fromResolutionResult()
44-
}
45-
}
35+
licenses {
36+
license {
37+
name.set("Apache-2.0")
4638
}
4739
}
48-
}
49-
}
5040

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"])
62-
}
63-
}
41+
developers {
42+
developer {
43+
name.set("Openlayer")
44+
email.set("[email protected]")
45+
}
46+
}
6447

65-
tasks.named("publish") {
66-
dependsOn(":closeAndReleaseSonatypeStagingRepository")
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+
}
53+
}
6754
}

0 commit comments

Comments
 (0)