Skip to content

Commit 12e769e

Browse files
committed
add checkVersionIsSnapshot task to CI and publish-snapshot actions
1 parent 93d0e83 commit 12e769e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.github/workflows/kotlin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs :
8080
gradle-dependencies-cache-key : |
8181
gradle/libs.versions.toml
8282
arguments : |
83-
check apiCheck artifactsCheck dependencyGuard lint ktlintCheck jvmWorkflowNodeBenchmarkJar --no-daemon --stacktrace --continue
83+
check apiCheck checkVersionIsSnapshot artifactsCheck dependencyGuard lint ktlintCheck jvmWorkflowNodeBenchmarkJar --no-daemon --stacktrace --continue
8484
concurrent : true
8585
gradle-build-scan-report : false
8686
gradle-distribution-sha-256-sum-warning : false

.github/workflows/publish-snapshot.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
distribution: 'zulu'
2323
java-version: 11
2424

25+
- name : Check for -SNAPSHOT version
26+
run: ./gradlew checkVersionIsSnapshot --no-daemon
27+
2528
- name : Publish Snapshots
2629
run: |
2730
./gradlew clean build --no-daemon

buildSrc/src/main/java/published.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@ version = project.property("VERSION_NAME") as String
1616
mavenPublish {
1717
sonatypeHost = SonatypeHost.S01
1818
}
19+
20+
tasks.register("checkVersionIsSnapshot") {
21+
doLast {
22+
val expected = "-SNAPSHOT"
23+
require((version as String).endsWith(expected)) {
24+
"The project's version name must be suffixed with `$expected` when checked in" +
25+
" to the main branch, but instead it's `$version`."
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)