File tree Expand file tree Collapse file tree 7 files changed +59
-43
lines changed
src/main/resources/native Expand file tree Collapse file tree 7 files changed +59
-43
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ plugins {
5
5
id(" buildlogic.java-library-conventions" )
6
6
// Apply the maven-publish plugin from com.vanniktech for publishing to repositories
7
7
id(" com.vanniktech.maven.publish" )
8
+ id(" signing" )
8
9
}
9
10
10
11
group = " org.xxdc.oss.example"
@@ -80,13 +81,11 @@ if (enablePreviewFeatures) {
80
81
81
82
// Publishing
82
83
mavenPublishing {
83
- publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL )
84
+ publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL , automaticRelease = true )
84
85
val signingKey = (findProperty(" signingInMemoryKey" ) ? : findProperty(" signing.key" )) as String?
85
- // if (signingKey != null) {
86
- if (false ) {
86
+ if (signingKey != null ) {
87
87
signAllPublications()
88
88
}
89
-
90
89
coordinates (
91
90
project.group as String? ,
92
91
" tictactoe-api" ,
@@ -110,3 +109,8 @@ publishing {
110
109
}
111
110
}
112
111
}
112
+
113
+ signing {
114
+ useGpgCmd()
115
+ sign(publishing.publications)
116
+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ plugins {
7
7
id(" buildlogic.java-application-conventions" )
8
8
id(" org.graalvm.buildtools.native" ) version " 0.10.2"
9
9
id(" com.vanniktech.maven.publish" )
10
+ id(" signing" )
10
11
}
11
12
12
13
group = " org.xxdc.oss.example"
@@ -149,10 +150,9 @@ if (enablePreviewFeatures) {
149
150
150
151
// Publishing
151
152
mavenPublishing {
152
- publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL )
153
+ publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL , automaticRelease = true )
153
154
val signingKey = (findProperty(" signingInMemoryKey" ) ? : findProperty(" signing.key" )) as String?
154
- // if (signingKey != null) {
155
- if (false ) {
155
+ if (signingKey != null ) {
156
156
signAllPublications()
157
157
}
158
158
@@ -179,3 +179,8 @@ publishing {
179
179
}
180
180
}
181
181
}
182
+
183
+ signing {
184
+ useGpgCmd()
185
+ sign(publishing.publications)
186
+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,30 @@ tasks.register("checkSigningSetup") {
7
7
group = " verification"
8
8
description = " Verifies that signing-related environment variables are set."
9
9
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
+
10
34
doLast {
11
35
val requiredEnvVars = listOf (
12
36
" ORG_GRADLE_PROJECT_signingInMemoryKey" ,
Original file line number Diff line number Diff line change @@ -81,36 +81,9 @@ java {
81
81
}
82
82
}
83
83
84
- val isSnapshot = false
84
+ val isSnapshot = true
85
85
version = if (isSnapshot) {
86
86
" $projectVersion -jdk${jdkVersion} -SNAPSHOT"
87
87
} else {
88
88
" $projectVersion -jdk${jdkVersion} "
89
89
}
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
-
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ plugins {
5
5
// Apply the application plugin to add support for building a CLI application in Java.
6
6
id(" buildlogic.java-library-conventions" )
7
7
id(" com.vanniktech.maven.publish" )
8
+ id(" signing" )
8
9
}
9
10
10
11
group = " org.xxdc.oss.example"
@@ -109,10 +110,9 @@ tasks.named("sourcesJar") {
109
110
110
111
// Publishing
111
112
mavenPublishing {
112
- publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL )
113
+ publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL , automaticRelease = true )
113
114
val signingKey = (findProperty(" signingInMemoryKey" ) ? : findProperty(" signing.key" )) as String?
114
- // if (signingKey != null) {
115
- if (false ) {
115
+ if (signingKey != null ) {
116
116
signAllPublications()
117
117
}
118
118
@@ -139,4 +139,9 @@ publishing {
139
139
}
140
140
}
141
141
}
142
- }
142
+ }
143
+
144
+ signing {
145
+ useGpgCmd()
146
+ sign(publishing.publications)
147
+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import com.vanniktech.maven.publish.SonatypeHost
4
4
plugins {
5
5
id(" buildlogic.java-library-conventions" )
6
6
id(" com.vanniktech.maven.publish" )
7
+ id(" signing" )
7
8
}
8
9
9
10
group = " org.xxdc.oss.example"
@@ -69,10 +70,9 @@ if (enablePreviewFeatures) {
69
70
70
71
// Publishing
71
72
mavenPublishing {
72
- publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL )
73
+ publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL , automaticRelease = true )
73
74
val signingKey = (findProperty(" signingInMemoryKey" ) ? : findProperty(" signing.key" )) as String?
74
- // if (signingKey != null) {
75
- if (false ) {
75
+ if (signingKey != null ) {
76
76
signAllPublications()
77
77
}
78
78
@@ -98,4 +98,9 @@ publishing {
98
98
}
99
99
}
100
100
}
101
- }
101
+ }
102
+
103
+ signing {
104
+ useGpgCmd()
105
+ sign(publishing.publications)
106
+ }
You can’t perform that action at this time.
0 commit comments