Skip to content

Commit fe4b623

Browse files
committed
Fix release publishing
1 parent c4194a4 commit fe4b623

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,27 @@ nexusPublishing {
3939
}
4040
}
4141
}
42+
43+
tasks.register("publishRelease") {
44+
group = "publishing"
45+
description = "Publish to Maven Central (iff this is a release version)."
46+
47+
onlyIf { !isSnapshot() }
48+
49+
if (!isSnapshot()) {
50+
dependsOn("publishToSonatype", "closeAndReleaseStagingRepositories")
51+
}
52+
}
53+
54+
tasks.register("publishSnapshot") {
55+
group = "publishing"
56+
description = "Publish to Maven Central (iff this is a snapshot version)."
57+
58+
onlyIf { isSnapshot() }
59+
60+
if (isSnapshot()) {
61+
dependsOn("publishToSonatype")
62+
}
63+
}
64+
65+
fun isSnapshot() = version.toString().endsWith("-SNAPSHOT")

library/build.gradle.kts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,6 @@ val dokkaJavadocJar by tasks.registering(Jar::class) {
3333
from(tasks.dokkaGeneratePublicationJavadoc)
3434
}
3535

36-
tasks.register("publishRelease") {
37-
group = "publishing"
38-
description = "Publish to Maven Central (iff this is a release version)."
39-
40-
onlyIf { !isSnapshot() }
41-
42-
if (!isSnapshot()) {
43-
dependsOn("publishToSonatype", "closeAndReleaseStagingRepositories")
44-
}
45-
}
46-
47-
tasks.register("publishSnapshot") {
48-
group = "publishing"
49-
description = "Publish to Maven Central (iff this is a snapshot version)."
50-
51-
onlyIf { isSnapshot() }
52-
53-
if (isSnapshot()) {
54-
dependsOn("publishToSonatype")
55-
}
56-
}
57-
5836
publishing {
5937
publications {
6038
create<MavenPublication>("library") {

0 commit comments

Comments
 (0)