1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-07-04 19:13:21 +00:00

Make current branch detection more robust

This commit is contained in:
Jonathan Coates 2021-08-06 18:04:05 +01:00
parent bb1ebaee4f
commit a8f675c59d
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -573,12 +573,17 @@ task setupServer(type: Copy) {
owner 'SquidDev-CC'
repo 'CC-Tweaked'
targetCommitish.set(project.provider({
try {
return ["git", "-C", projectDir, "rev-parse", "--abbrev-ref", "HEAD"].execute().text.trim()
} catch (Exception e) {
e.printStackTrace()
def cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
println(cmd)
def proc = cmd.execute([], projectDir)
if (proc.waitFor() != 0) {
println(proc.err.text.trim())
throw new IllegalStateException("Executed with a non-0 exit code (${proc.exitValue()}).")
}
return "master"
def branch = proc.text.trim()
if (branch == "") throw new IllegalStateException("Cannot determine branch")
return branch
}))
tagName "v${mc_version}-${mod_version}"