fix(autoversion): handle empty CI_COMMIT_TAG by ignoring it
All checks were successful
ci/woodpecker/push/pages Pipeline was successful
ci/woodpecker/push/gradle Pipeline was successful

This commit is contained in:
Johannes Frohnmeyer 2024-10-10 11:22:28 +02:00
parent b18e8d2a5c
commit 5583d335d1
Signed by: Johannes
GPG Key ID: E76429612C2929F4

View File

@ -7,7 +7,7 @@ val isRelease = project.hasProperty("release")
val specialCaseBuilds = setOf("forge", "fabric", "neoforge") val specialCaseBuilds = setOf("forge", "fabric", "neoforge")
fun List<Tag>.filter(): Pair<Tag, Tag?>? { fun List<Tag>.filter(): Pair<Tag, Tag?>? {
if (isEmpty()) return null if (isEmpty()) return null
val envName = System.getenv("CI_COMMIT_TAG") val envName = System.getenv("CI_COMMIT_TAG")?.ifEmpty { null }
val current = envName?.let { v -> indexOfFirst { it.name == v } } ?: 0 val current = envName?.let { v -> indexOfFirst { it.name == v } } ?: 0
if (current == -1) throw IllegalStateException("Current tag ($envName) not found in tag list") if (current == -1) throw IllegalStateException("Current tag ($envName) not found in tag list")
if (size == current) return get(current) to null if (size == current) return get(current) to null