diff --git a/buildSrc/src/main/kotlin/bluemap.base.gradle.kts b/buildSrc/src/main/kotlin/bluemap.base.gradle.kts index 8c1c0b4f..078ba7bd 100644 --- a/buildSrc/src/main/kotlin/bluemap.base.gradle.kts +++ b/buildSrc/src/main/kotlin/bluemap.base.gradle.kts @@ -73,7 +73,10 @@ publishing { repositories { maven { name = "bluecolored" - url = uri( "https://repo.bluecolored.de/releases" ) + url = uri("https://repo.bluecolored.de/releases") + + if (!gitIsRelease()) + url = uri("https://repo.bluecolored.de/snapshots") credentials { username = project.findProperty("bluecoloredUsername") as String? ?: System.getenv("BLUECOLORED_USERNAME") diff --git a/buildSrc/src/main/kotlin/versioning.kt b/buildSrc/src/main/kotlin/versioning.kt index 687b2c74..b79ac65d 100644 --- a/buildSrc/src/main/kotlin/versioning.kt +++ b/buildSrc/src/main/kotlin/versioning.kt @@ -24,6 +24,12 @@ fun Project.gitVersion(): String { return gitVersion } +fun Project.gitIsRelease(): Boolean { + val lastTag = if (runCommand("git tag", "").isEmpty()) "" else runCommand("git describe --tags --abbrev=0", "") + val commits = runCommand("git rev-list --count $lastTag..HEAD", "0") + return commits == "0" && gitClean() +} + fun Project.releaseNotes(): String { val file = rootProject.projectDir.resolve("release.md") if (!file.exists()) return ""