Skip to content

Commit 7687f26

Browse files
committed
Trying to fix snapshot publishing
1 parent 62b8aec commit 7687f26

File tree

2 files changed

+93
-68
lines changed

2 files changed

+93
-68
lines changed

build.gradle.kts

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ dependencies {
2222
testImplementation(libs.mockk)
2323
}
2424

25-
val signingKey: String? by project
26-
val signingPassword: String? by project
27-
28-
val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications
29-
30-
signing {
31-
useGpgCmd()
32-
if (signingKey != null && signingPassword != null) {
33-
@Suppress("UnstableApiUsage")
34-
useInMemoryPgpKeys(signingKey, signingPassword)
35-
}
36-
if (Ci.isRelease) {
37-
sign(publications)
38-
}
39-
}
40-
4125
java {
4226
withJavadocJar()
4327
withSourcesJar()
@@ -46,58 +30,7 @@ java {
4630
}
4731
}
4832

49-
publishing {
50-
repositories {
51-
maven {
52-
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
53-
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
54-
name = "deploy"
55-
url = if (Ci.isRelease) releasesRepoUrl else snapshotsRepoUrl
56-
credentials {
57-
username = System.getenv("OSSRH_USERNAME") ?: ""
58-
password = System.getenv("OSSRH_PASSWORD") ?: ""
59-
}
60-
}
61-
}
62-
63-
publications {
64-
register("mavenJava", MavenPublication::class) {
65-
from(components["java"])
66-
pom {
67-
name.set("kotest-extensions-skippy")
68-
description.set("Kotest extension for Skippy")
69-
url.set("https://www.github.com/kotest/kotest-extensions-skippy")
70-
71-
scm {
72-
connection.set("scm:git:http://www.github.com/kotest/kotest-extensions-skippy")
73-
developerConnection.set("scm:git:http://github.com/kantis")
74-
url.set("https://www.github.com/kotest/kotest-extensions-skippy")
75-
}
76-
77-
licenses {
78-
license {
79-
name.set("The Apache 2.0 License")
80-
url.set("https://opensource.org/licenses/Apache-2.0")
81-
}
82-
}
83-
84-
developers {
85-
developer {
86-
id.set("sksamuel")
87-
name.set("Stephen Samuel")
88-
email.set("[email protected]")
89-
}
90-
91-
developer {
92-
id.set("Kantis")
93-
name.set("Emil Kantis")
94-
email.set("[email protected]")
95-
}
96-
}
97-
}
98-
}
99-
}
100-
}
33+
apply("./publish.gradle.kts")
10134

10235
@Suppress("UnstableApiUsage")
10336
testing {

publish.gradle.kts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
apply(plugin = "java")
2+
apply(plugin = "java-library")
3+
apply(plugin = "maven-publish")
4+
apply(plugin = "signing")
5+
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
val signingKey: String? by project
11+
val signingPassword: String? by project
12+
13+
fun Project.publishing(action: PublishingExtension.() -> Unit) =
14+
configure(action)
15+
16+
fun Project.signing(configure: SigningExtension.() -> Unit): Unit =
17+
configure(configure)
18+
19+
fun Project.java(configure: JavaPluginExtension.() -> Unit): Unit =
20+
configure(configure)
21+
22+
23+
val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications
24+
25+
signing {
26+
useGpgCmd()
27+
if (signingKey != null && signingPassword != null) {
28+
@Suppress("UnstableApiUsage")
29+
useInMemoryPgpKeys(signingKey, signingPassword)
30+
}
31+
if (Ci.isRelease) {
32+
sign(publications)
33+
}
34+
}
35+
36+
java {
37+
withJavadocJar()
38+
withSourcesJar()
39+
}
40+
41+
publishing {
42+
repositories {
43+
maven {
44+
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
45+
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
46+
name = "deploy"
47+
url = if (Ci.isRelease) releasesRepoUrl else snapshotsRepoUrl
48+
credentials {
49+
username = java.lang.System.getenv("OSSRH_USERNAME") ?: ""
50+
password = java.lang.System.getenv("OSSRH_PASSWORD") ?: ""
51+
}
52+
}
53+
}
54+
55+
publications {
56+
register("mavenJava", MavenPublication::class) {
57+
from(components["java"])
58+
pom {
59+
name.set("kotest-extensions-skippy")
60+
description.set("Kotest extension for Skippy")
61+
url.set("https://www.github.com/kotest/kotest-extensions-skippy")
62+
63+
scm {
64+
connection.set("scm:git:http://www.github.com/kotest/kotest-extensions-skippy")
65+
developerConnection.set("scm:git:http://github.com/kantis")
66+
url.set("https://www.github.com/kotest/kotest-extensions-skippy")
67+
}
68+
69+
licenses {
70+
license {
71+
name.set("The Apache 2.0 License")
72+
url.set("https://opensource.org/licenses/Apache-2.0")
73+
}
74+
}
75+
76+
developers {
77+
developer {
78+
id.set("sksamuel")
79+
name.set("Stephen Samuel")
80+
email.set("[email protected]")
81+
}
82+
83+
developer {
84+
id.set("Kantis")
85+
name.set("Emil Kantis")
86+
email.set("[email protected]")
87+
}
88+
}
89+
}
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)