Skip to content

Commit 88deabe

Browse files
committed
build(gradle/server): fix version detection for ci
1 parent de6f13b commit 88deabe

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

server/build.gradle.kts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,20 @@ tasks {
6161
if(project.property("enableTestClient") !in arrayOf(null, false))
6262
from(project(":test-client").getTasksByName("copyLogbackConfig", false))
6363
from(project(":player").getTasksByName("shadowJar", false))
64-
exec {
65-
commandLine("git", "describe", "--long", "--tags")
66-
standardOutput = runnableDir.resolve("version").outputStream()
64+
65+
val versionFile = runnableDir.resolve("version")
66+
try {
67+
exec {
68+
commandLine("git", "describe", "--long", "--tags")
69+
standardOutput = versionFile.outputStream()
70+
}
71+
} catch(e: Exception) {
72+
println("Issue with git describe for version detection, falling back to rev-parse: $e")
73+
println(versionFile.readText())
74+
exec {
75+
commandLine("git", "rev-parse", "HEAD")
76+
standardOutput = versionFile.outputStream()
77+
}
6778
}
6879
}
6980
}

0 commit comments

Comments
 (0)