Skip to content

Commit 14f3701

Browse files
chore: bump version for maven central publishing
1 parent df43850 commit 14f3701

File tree

4 files changed

+91
-81
lines changed

4 files changed

+91
-81
lines changed

api/build.gradle.kts

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,32 @@ publishing {
8686
repositories {
8787
// Publish to GitHub Packages
8888
// https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-gradle
89-
maven {
90-
name = "Sonatype"
91-
url = uri(
92-
if (version.toString().endsWith("SNAPSHOT"))
93-
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
94-
else
95-
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
96-
)
97-
credentials {
98-
username = project.findProperty("sonatype.user") as String? ?: System.getenv("SONATYPE_USER")
99-
password = project.findProperty("sonatype.key") as String? ?: System.getenv("SONATYPE_TOKEN")
89+
val targetRepo: String? = findProperty("repo") as String?
90+
if (targetRepo == null || targetRepo == "Sonatype") {
91+
maven {
92+
name = "Sonatype"
93+
url = uri(
94+
if (version.toString().endsWith("SNAPSHOT"))
95+
//"https://s01.oss.sonatype.org/content/repositories/snapshots/"
96+
"https://central.sonatype.com/repository/maven-snapshots/"
97+
else
98+
// "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
99+
"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
100+
)
101+
credentials {
102+
username = project.findProperty("sonatype.user") as String? ?: System.getenv("SONATYPE_USER")
103+
password = project.findProperty("sonatype.key") as String? ?: System.getenv("SONATYPE_TOKEN")
104+
}
100105
}
101106
}
102-
maven {
103-
name = "GitHubPackages"
104-
url = uri("https://maven.pkg.github.com/briancorbinxyz/overengineering-tictactoe")
105-
credentials {
106-
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
107-
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
107+
if (targetRepo == null || targetRepo == "GitHubPackages") {
108+
maven {
109+
name = "GitHubPackages"
110+
url = uri("https://maven.pkg.github.com/briancorbinxyz/overengineering-tictactoe")
111+
credentials {
112+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
113+
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
114+
}
108115
}
109116
}
110117
}
@@ -154,19 +161,16 @@ val signingKeyId = System.getenv("SIGNING_KEY_ID") ?: findProperty("signing.keyI
154161

155162
val isPublishing = gradle.startParameter.taskNames.any { it.contains("publish", ignoreCase = true) }
156163

157-
val shouldSign = isPublishing && signingKey != null && signingPassword != null
164+
val shouldSign = signingKey != null && signingPassword != null
158165

159166
logger.lifecycle("🔐 Signing check:")
160167
logger.lifecycle(" • isPublishing: $isPublishing")
161168
logger.lifecycle(" • signingKeyId: ${signingKeyId != null}")
162169
logger.lifecycle(" • signingKey present: ${signingKey != null}")
163170
logger.lifecycle(" • signingPassword present: ${signingPassword != null}")
164-
165-
if (shouldSign) {
166-
signing {
167-
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
168-
sign(publishing.publications)
169-
}
170-
} else {
171-
logger.lifecycle("⚠️ Skipping signing: Not publishing or signing credentials are incomplete.")
172-
}
171+
logger.lifecycle(" • shouldSign: $shouldSign")
172+
signing {
173+
setRequired({ isPublishing && shouldSign })
174+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
175+
sign(configurations.runtimeElements.get())
176+
}

app/build.gradle.kts

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -155,25 +155,30 @@ publishing {
155155
repositories {
156156
// Publish to GitHub Packages
157157
// https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-gradle
158-
maven {
159-
name = "Sonatype"
160-
url = uri(
161-
if (version.toString().endsWith("SNAPSHOT"))
162-
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
163-
else
164-
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
165-
)
166-
credentials {
167-
username = project.findProperty("sonatype.user") as String? ?: System.getenv("SONATYPE_USER")
168-
password = project.findProperty("sonatype.key") as String? ?: System.getenv("SONATYPE_TOKEN")
158+
val targetRepo: String? = findProperty("repo") as String?
159+
if (targetRepo == null || targetRepo == "Sonatype") {
160+
maven {
161+
name = "Sonatype"
162+
url = uri(
163+
if (version.toString().endsWith("SNAPSHOT"))
164+
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
165+
else
166+
"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
167+
)
168+
credentials {
169+
username = project.findProperty("sonatype.user") as String? ?: System.getenv("SONATYPE_USER")
170+
password = project.findProperty("sonatype.key") as String? ?: System.getenv("SONATYPE_TOKEN")
171+
}
169172
}
170173
}
171-
maven {
172-
name = "GitHubPackages"
173-
url = uri("https://maven.pkg.github.com/briancorbinxyz/overengineering-tictactoe")
174-
credentials {
175-
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
176-
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
174+
if (targetRepo == null || targetRepo == "GitHubPackages") {
175+
maven {
176+
name = "GitHubPackages"
177+
url = uri("https://maven.pkg.github.com/briancorbinxyz/overengineering-tictactoe")
178+
credentials {
179+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
180+
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
181+
}
177182
}
178183
}
179184
}
@@ -224,19 +229,16 @@ val signingKeyId = System.getenv("SIGNING_KEY_ID") ?: findProperty("signing.keyI
224229

225230
val isPublishing = gradle.startParameter.taskNames.any { it.contains("publish", ignoreCase = true) }
226231

227-
val shouldSign = isPublishing && signingKey != null && signingPassword != null
232+
val shouldSign = signingKey != null && signingPassword != null
228233

229234
logger.lifecycle("🔐 Signing check:")
230235
logger.lifecycle(" • isPublishing: $isPublishing")
231236
logger.lifecycle(" • signingKeyId: ${signingKeyId != null}")
232237
logger.lifecycle(" • signingKey present: ${signingKey != null}")
233238
logger.lifecycle(" • signingPassword present: ${signingPassword != null}")
234-
235-
if (shouldSign) {
236-
signing {
237-
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
238-
sign(publishing.publications)
239-
}
240-
} else {
241-
logger.lifecycle("⚠️ Skipping signing: Not publishing or signing credentials are incomplete.")
242-
}
239+
logger.lifecycle(" • shouldSign: $shouldSign")
240+
signing {
241+
setRequired({ isPublishing && shouldSign })
242+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
243+
sign(configurations.runtimeElements.get())
244+
}

buildSrc/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ testing {
7070
}
7171
}
7272

73-
val projectVersion by extra("2.0.8")
73+
val projectVersion by extra("2.0.9")
7474

7575
public val jdkVersion = 24
7676
// Apply a specific Java toolchain to ease working on different environments.

tcp-gameserver/build.gradle.kts

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,32 @@ publishing {
7474
repositories {
7575
// Publish to GitHub Packages
7676
// https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-gradle
77-
maven {
78-
name = "Sonatype"
79-
url = uri(
80-
if (version.toString().endsWith("SNAPSHOT"))
81-
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
82-
else
83-
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
84-
)
85-
credentials {
86-
username = project.findProperty("sonatype.user") as String? ?: System.getenv("SONATYPE_USER")
87-
password = project.findProperty("sonatype.key") as String? ?: System.getenv("SONATYPE_TOKEN")
77+
val targetRepo: String? = findProperty("repo") as String?
78+
if (targetRepo == null || targetRepo == "Sonatype") {
79+
maven {
80+
name = "Sonatype"
81+
url = uri(
82+
if (version.toString().endsWith("SNAPSHOT"))
83+
//"https://s01.oss.sonatype.org/content/repositories/snapshots/"
84+
"https://central.sonatype.com/repository/maven-snapshots/"
85+
else
86+
// "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
87+
"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
88+
)
89+
credentials {
90+
username = project.findProperty("sonatype.user") as String? ?: System.getenv("SONATYPE_USER")
91+
password = project.findProperty("sonatype.key") as String? ?: System.getenv("SONATYPE_TOKEN")
92+
}
8893
}
8994
}
90-
maven {
91-
name = "GitHubPackages"
92-
url = uri("https://maven.pkg.github.com/briancorbinxyz/overengineering-tictactoe")
93-
credentials {
94-
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
95-
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
95+
if (targetRepo == null || targetRepo == "GitHubPackages") {
96+
maven {
97+
name = "GitHubPackages"
98+
url = uri("https://maven.pkg.github.com/briancorbinxyz/overengineering-tictactoe")
99+
credentials {
100+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
101+
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
102+
}
96103
}
97104
}
98105
}
@@ -143,19 +150,16 @@ val signingKeyId = System.getenv("SIGNING_KEY_ID") ?: findProperty("signing.keyI
143150

144151
val isPublishing = gradle.startParameter.taskNames.any { it.contains("publish", ignoreCase = true) }
145152

146-
val shouldSign = isPublishing && signingKey != null && signingPassword != null
153+
val shouldSign = signingKey != null && signingPassword != null
147154

148155
logger.lifecycle("🔐 Signing check:")
149156
logger.lifecycle(" • isPublishing: $isPublishing")
150157
logger.lifecycle(" • signingKeyId: ${signingKeyId != null}")
151158
logger.lifecycle(" • signingKey present: ${signingKey != null}")
152159
logger.lifecycle(" • signingPassword present: ${signingPassword != null}")
153-
154-
if (shouldSign) {
155-
signing {
156-
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
157-
sign(publishing.publications)
158-
}
159-
} else {
160-
logger.lifecycle("⚠️ Skipping signing: Not publishing or signing credentials are incomplete.")
160+
logger.lifecycle(" • shouldSign: $shouldSign")
161+
signing {
162+
setRequired({ isPublishing && shouldSign })
163+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
164+
sign(configurations.runtimeElements.get())
161165
}

0 commit comments

Comments
 (0)