Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke committed Dec 27, 2021
1 parent b72d0fc commit 0194ac0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Expand Up @@ -239,17 +239,17 @@ task("tagRelease") {
doLast {
val tagName = versioning.info.nextVersion() ?: throw IllegalStateException("unable to compute tag name")
exec {
commandLine("git", "tag", tagName)
commandLine("echo", "git", "tag", tagName)
}
exec {
commandLine("git", "push", "origin", "refs/tags/$tagName")
commandLine("echo", "git", "push", "origin", "refs/tags/$tagName")
}
}
}

fun VersionInfo.nextVersion() = when {
this.tag == null && this.branch == "main" -> {
val matchResult = Regex("v(\\d+)\\.(\\d+)").matchEntire(this.lastTag ?: "")
val matchResult = Regex("v(\\d+)\\.(\\d+)(?:.\\d+)").matchEntire(this.lastTag ?: "")
if (matchResult != null) {
val (_, major, minor) = matchResult.groupValues
"v$major.${minor.toInt() + 1}"
Expand Down

0 comments on commit 0194ac0

Please sign in to comment.