Fix ci versioning 2

This commit is contained in:
Lukas Rieger (Blue) 2022-07-27 12:30:11 +02:00
parent 32269cc012
commit 55dbf38144
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
1 changed files with 9 additions and 3 deletions

View File

@ -23,17 +23,23 @@ fun String.runCommand(): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`]
val gitHash = "git rev-parse --verify HEAD".runCommand()
val clean = "git status --porcelain".runCommand().isEmpty()
val branch = "git branch --show-current".runCommand()
val branch = "git rev-parse --abbrev-ref HEAD".runCommand()
val commitCount = "git rev-list --count HEAD".runCommand()
if (branch.isEmpty()) {
throw IllegalStateException("Could not determine branch name")
}
println("Git hash: $gitHash" + if (clean) "" else " (dirty)")
println("Branch: $branch")
val releaseProperties = Properties()
releaseProperties.load(file("../release.properties").inputStream())
group = "de.bluecolored.bluemap.core"
version = releaseProperties["version"].toString() + ".$commitCount" +
if (clean) "" else ".dirty" +
if (branch == "master") "" else "-$branch"
(if (clean) "" else ".dirty") +
(if (branch == "master") "" else "-$branch")
println("Version: $version")
val javaTarget = 11