File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 1+ import java.net.URL
2+ import javax.net.ssl.HttpsURLConnection
3+
14plugins {
25 `java- library`
36 `maven- publish`
@@ -50,11 +53,30 @@ publishing.publications {
5053 }
5154}
5255
56+
57+ val shouldPublish by lazy {
58+ val conn = URL (" https://repo1.maven.org/maven2/club/minnced/udpqueue-api/$version /" ).openConnection() as HttpsURLConnection
59+ conn.requestMethod = " GET"
60+ conn.connect()
61+
62+ conn.responseCode > 400
63+ }
64+
5365val signingKey: String? by project
66+ val signingPassword: String? by project
5467
5568if (signingKey != null ) {
5669 signing {
57- useInMemoryPgpKeys(signingKey, null )
58- sign(* publishing.publications.toTypedArray())
70+ useInMemoryPgpKeys(signingKey, signingPassword ? : " " )
71+ val publications = publishing.publications.toTypedArray()
72+ sign(* publications)
5973 }
74+ } else {
75+ println (" Could not find signingKey" )
76+ }
77+
78+ // Only run publishing tasks if the version doesn't already exist
79+
80+ tasks.withType<PublishToMavenRepository > {
81+ enabled = enabled && shouldPublish
6082}
You can’t perform that action at this time.
0 commit comments