Skip to content

Commit 67f23e9

Browse files
chore: use GPG command for signing since the java pg signing was not working locally on Mac
1 parent 88d4c57 commit 67f23e9

File tree

7 files changed

+59
-43
lines changed

7 files changed

+59
-43
lines changed

api/build.gradle.kts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
id("buildlogic.java-library-conventions")
66
// Apply the maven-publish plugin from com.vanniktech for publishing to repositories
77
id("com.vanniktech.maven.publish")
8+
id("signing")
89
}
910

1011
group = "org.xxdc.oss.example"
@@ -80,13 +81,11 @@ if (enablePreviewFeatures) {
8081

8182
// Publishing
8283
mavenPublishing {
83-
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
84+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
8485
val signingKey = (findProperty("signingInMemoryKey") ?: findProperty("signing.key")) as String?
85-
//if (signingKey != null) {
86-
if (false) {
86+
if (signingKey != null) {
8787
signAllPublications()
8888
}
89-
9089
coordinates (
9190
project.group as String?,
9291
"tictactoe-api",
@@ -110,3 +109,8 @@ publishing {
110109
}
111110
}
112111
}
112+
113+
signing {
114+
useGpgCmd()
115+
sign(publishing.publications)
116+
}

app/build.gradle.kts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id("buildlogic.java-application-conventions")
88
id("org.graalvm.buildtools.native") version "0.10.2"
99
id("com.vanniktech.maven.publish")
10+
id("signing")
1011
}
1112

1213
group = "org.xxdc.oss.example"
@@ -149,10 +150,9 @@ if (enablePreviewFeatures) {
149150

150151
// Publishing
151152
mavenPublishing {
152-
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
153+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
153154
val signingKey = (findProperty("signingInMemoryKey") ?: findProperty("signing.key")) as String?
154-
//if (signingKey != null) {
155-
if (false) {
155+
if (signingKey != null) {
156156
signAllPublications()
157157
}
158158

@@ -179,3 +179,8 @@ publishing {
179179
}
180180
}
181181
}
182+
183+
signing {
184+
useGpgCmd()
185+
sign(publishing.publications)
186+
}

build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ tasks.register("checkSigningSetup") {
77
group = "verification"
88
description = "Verifies that signing-related environment variables are set."
99

10+
doLast {
11+
val requiredEnvVars = listOf(
12+
"signingInMemoryKey",
13+
"signingInMemoryKeyId",
14+
"signingInMemoryKeyPassword"
15+
)
16+
17+
val missing = requiredEnvVars.filter { (findProperty(it) as String?).isNullOrBlank() }
18+
19+
if (missing.isNotEmpty()) {
20+
throw GradleException(
21+
"❌ Missing required environment variables for signing: ${missing.joinToString()}\n" +
22+
"Ensure these are set in your environment or CI configuration."
23+
)
24+
} else {
25+
println("✔ All required signing environment variables are set.")
26+
}
27+
}
28+
}
29+
30+
tasks.register("checkSigningEnvSetup") {
31+
group = "verification"
32+
description = "Verifies that signing-related environment variables are set."
33+
1034
doLast {
1135
val requiredEnvVars = listOf(
1236
"ORG_GRADLE_PROJECT_signingInMemoryKey",

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

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,36 +81,9 @@ java {
8181
}
8282
}
8383

84-
val isSnapshot = false
84+
val isSnapshot = true
8585
version = if (isSnapshot) {
8686
"$projectVersion-jdk${jdkVersion}-SNAPSHOT"
8787
} else {
8888
"$projectVersion-jdk${jdkVersion}"
8989
}
90-
91-
// Signing Checks
92-
tasks.register("checkSigningSetup") {
93-
group = "verification"
94-
description = "Verifies that signing-related environment variables are set."
95-
96-
doLast {
97-
val requiredEnvVars = listOf(
98-
"ORG_GRADLE_PROJECT_signingInMemoryKey",
99-
"ORG_GRADLE_PROJECT_signingInMemoryKeyId",
100-
"ORG_GRADLE_PROJECT_signingInMemoryKeyPassword"
101-
)
102-
103-
val missing = requiredEnvVars.filter { System.getenv(it).isNullOrBlank() }
104-
105-
if (missing.isNotEmpty()) {
106-
throw GradleException(
107-
"❌ Missing required environment variables for signing: ${missing.joinToString()}\n" +
108-
"Ensure these are set in your environment or CI configuration."
109-
)
110-
} else {
111-
println("✔ All required signing environment variables are set.")
112-
}
113-
}
114-
}
115-
116-

native/build.gradle.kts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
// Apply the application plugin to add support for building a CLI application in Java.
66
id("buildlogic.java-library-conventions")
77
id("com.vanniktech.maven.publish")
8+
id("signing")
89
}
910

1011
group = "org.xxdc.oss.example"
@@ -109,10 +110,9 @@ tasks.named("sourcesJar") {
109110

110111
// Publishing
111112
mavenPublishing {
112-
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
113+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
113114
val signingKey = (findProperty("signingInMemoryKey") ?: findProperty("signing.key")) as String?
114-
//if (signingKey != null) {
115-
if (false) {
115+
if (signingKey != null) {
116116
signAllPublications()
117117
}
118118

@@ -139,4 +139,9 @@ publishing {
139139
}
140140
}
141141
}
142-
}
142+
}
143+
144+
signing {
145+
useGpgCmd()
146+
sign(publishing.publications)
147+
}
Binary file not shown.

tcp-gameserver/build.gradle.kts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.vanniktech.maven.publish.SonatypeHost
44
plugins {
55
id("buildlogic.java-library-conventions")
66
id("com.vanniktech.maven.publish")
7+
id("signing")
78
}
89

910
group = "org.xxdc.oss.example"
@@ -69,10 +70,9 @@ if (enablePreviewFeatures) {
6970

7071
// Publishing
7172
mavenPublishing {
72-
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
73+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
7374
val signingKey = (findProperty("signingInMemoryKey") ?: findProperty("signing.key")) as String?
74-
//if (signingKey != null) {
75-
if (false) {
75+
if (signingKey != null) {
7676
signAllPublications()
7777
}
7878

@@ -98,4 +98,9 @@ publishing {
9898
}
9999
}
100100
}
101-
}
101+
}
102+
103+
signing {
104+
useGpgCmd()
105+
sign(publishing.publications)
106+
}

0 commit comments

Comments
 (0)