From f533a34b8e9a07f67756b342200e5d3b5ff35bc7 Mon Sep 17 00:00:00 2001 From: Yuri Schimke Date: Sun, 26 Dec 2021 18:33:53 +0000 Subject: [PATCH] Fix tag versioning --- build.gradle.kts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 2f1e8859..6425c66a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import net.nemerosa.versioning.ReleaseInfo import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.apache.tools.ant.taskdefs.condition.Os @@ -14,6 +15,18 @@ plugins { id("org.jreleaser") version "0.9.1" } +versioning { + scm = "git" + releaseParser = KotlinClosure2({ scmInfo, _ -> + if (scmInfo.tag != null && scmInfo.tag.startsWith("v")) { + ReleaseInfo("release", scmInfo.tag.substring(1)) + } else { + val parts = scmInfo.branch.split("/", limit = 2) + ReleaseInfo(parts[0], parts.getOrNull(1) ?: "") + } + }) +} + application { mainClass.set("com.baulsupp.okurl.MainKt") }