Use snapshot repo for snapshot versions

This commit is contained in:
Lukas Rieger (Blue) 2024-11-02 19:08:43 +01:00
parent 4fc10b702e
commit 8d04785e3a
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
2 changed files with 10 additions and 1 deletions

View File

@ -73,7 +73,10 @@ publishing {
repositories { repositories {
maven { maven {
name = "bluecolored" 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 { credentials {
username = project.findProperty("bluecoloredUsername") as String? ?: System.getenv("BLUECOLORED_USERNAME") username = project.findProperty("bluecoloredUsername") as String? ?: System.getenv("BLUECOLORED_USERNAME")

View File

@ -24,6 +24,12 @@ fun Project.gitVersion(): String {
return gitVersion 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 { fun Project.releaseNotes(): String {
val file = rootProject.projectDir.resolve("release.md") val file = rootProject.projectDir.resolve("release.md")
if (!file.exists()) return "" if (!file.exists()) return ""