Skip to content

Commit bbd85bd

Browse files
committed
implemented workaround for publishing to sonatype portal
1 parent 1af295e commit bbd85bd

File tree

2 files changed

+57
-77
lines changed

2 files changed

+57
-77
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
uses: gradle/gradle-build-action@v2
1414
- name: Run build with Gradle Wrapper
1515
env:
16-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
17-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
16+
PORTAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
17+
PORTAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
1818
run: ./gradlew build

client/build.gradle.kts

Lines changed: 55 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import java.net.URI
1+
import net.thebugmc.gradle.sonatypepublisher.PublishingType
22
import java.util.Properties
33

44
plugins {
55
id("java-library")
6-
id("maven-publish")
7-
id("signing")
86
id("org.openapi.generator") version "7.5.0"
97
id("org.kordamp.gradle.jandex") version "2.0.0"
108
id("com.github.gmazzo.buildconfig") version "5.6.2"
9+
id("net.thebugmc.gradle.sonatype-central-portal-publisher") version "1.2.4"
1110
}
1211

12+
group = "io.apistax"
1313
version = "1.6.0"
1414

1515
dependencies {
@@ -104,91 +104,71 @@ openApiGenerate {
104104
}
105105

106106
val properties = Properties().apply {
107-
if (System.getenv().containsKey("OSSRH_USERNAME")) {
108-
put("ossrhUsername", System.getenv("OSSRH_USERNAME"))
109-
put("ossrhPassword", System.getenv("OSSRH_PASSWORD"))
107+
if (System.getenv().containsKey("PORTAL_USERNAME")) {
108+
put("portalUsername", System.getenv("PORTAL_USERNAME"))
109+
put("portalPassword", System.getenv("PORTAL_PASSWORD"))
110110
} else {
111111
load(project.rootProject.file("local.properties").inputStream())
112112
}
113113
}
114114

115-
publishing {
116-
publications {
117-
create<MavenPublication>("apistax") {
118-
groupId = "io.apistax"
119-
artifactId = "apistax-client"
120-
from(components["java"])
121-
122-
pom {
123-
name = "apistax-client"
124-
description = "Secure and reliable APIs for your common business needs."
125-
url = "https://apistax.io/"
126-
inceptionYear = "2022"
127-
128-
licenses {
129-
license {
130-
name = "Apache License 2.0"
131-
url = "https://raw.githubusercontent.com/APIstax/client-java/main/LICENSE"
132-
}
133-
}
134-
135-
organization {
136-
name = "instant:solutions OG"
137-
url = "https://instant-it.at/"
138-
}
139-
140-
developers {
141-
developer {
142-
id = "holzleitner"
143-
name = "Max Holzleitner"
144-
email = "max.holzleitner@instant-it.at"
145-
organization = "instant:solutions OG"
146-
organizationUrl = "https://instant-it.at/"
147-
timezone = "Europe/Vienna"
148-
}
149-
150-
developer {
151-
id = "andlinger"
152-
name = "David Andlinger"
153-
email = "david.andlinger@instant-it.at"
154-
organization = "instant:solutions OG"
155-
organizationUrl = "https://instant-it.at/"
156-
timezone = "Europe/Vienna"
157-
}
158-
}
159-
160-
scm {
161-
connection = "scm:git:github.com/apistax/client-java.git"
162-
developerConnection = "scm:git:github.com/apistax/client-java.git"
163-
url = "https://github.com/apistax/client-java"
164-
}
115+
centralPortal {
116+
username = properties.getProperty("portalUsername")
117+
password = properties.getProperty("portalPassword")
118+
119+
publishingType = PublishingType.AUTOMATIC
120+
121+
name = "apistax-client"
122+
123+
pom {
124+
name = "apistax-client"
125+
description = "Secure and reliable APIs for your common business needs."
126+
url = "https://apistax.io/"
127+
inceptionYear = "2022"
128+
129+
licenses {
130+
license {
131+
name = "Apache License 2.0"
132+
url = "https://raw.githubusercontent.com/APIstax/client-java/main/LICENSE"
165133
}
166134
}
167-
}
168135

169-
repositories {
170-
maven {
171-
name = "ossrh"
172-
url = URI("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
173-
credentials {
174-
username = properties.getProperty("ossrhUsername")
175-
password = properties.getProperty("ossrhPassword")
176-
}
136+
organization {
137+
name = "instant:solutions OG"
138+
url = "https://instant-it.at/"
177139
}
178140

179-
maven {
180-
name = "ossrhSnapshot"
181-
url = URI("https://s01.oss.sonatype.org/content/repositories/snapshots/")
182-
credentials {
183-
username = properties.getProperty("ossrhUsername")
184-
password = properties.getProperty("ossrhPassword")
141+
developers {
142+
developer {
143+
id = "holzleitner"
144+
name = "Max Holzleitner"
145+
email = "max.holzleitner@instant-it.at"
146+
organization = "instant:solutions OG"
147+
organizationUrl = "https://instant-it.at/"
148+
timezone = "Europe/Vienna"
149+
}
150+
151+
developer {
152+
id = "andlinger"
153+
name = "David Andlinger"
154+
email = "david.andlinger@instant-it.at"
155+
organization = "instant:solutions OG"
156+
organizationUrl = "https://instant-it.at/"
157+
timezone = "Europe/Vienna"
185158
}
186159
}
187-
}
188-
}
189160

190-
signing {
191-
sign(publishing.publications["apistax"])
161+
scm {
162+
connection = "scm:git:github.com/apistax/client-java.git"
163+
developerConnection = "scm:git:github.com/apistax/client-java.git"
164+
url = "https://github.com/apistax/client-java"
165+
}
166+
167+
issueManagement {
168+
system = "GitHub"
169+
url = "https://github.com/apistax/client-java/issues"
170+
}
171+
}
192172
}
193173

194174
tasks["compileJava"].setDependsOn(listOf(tasks["openApiGenerate"]))

0 commit comments

Comments
 (0)