mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-07-07 20:34:25 +00:00
Make current branch detection more robust
This commit is contained in:
parent
bb1ebaee4f
commit
a8f675c59d
15
build.gradle
15
build.gradle
|
@ -573,12 +573,17 @@ task setupServer(type: Copy) {
|
||||||
owner 'SquidDev-CC'
|
owner 'SquidDev-CC'
|
||||||
repo 'CC-Tweaked'
|
repo 'CC-Tweaked'
|
||||||
targetCommitish.set(project.provider({
|
targetCommitish.set(project.provider({
|
||||||
try {
|
def cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
|
||||||
return ["git", "-C", projectDir, "rev-parse", "--abbrev-ref", "HEAD"].execute().text.trim()
|
println(cmd)
|
||||||
} catch (Exception e) {
|
def proc = cmd.execute([], projectDir)
|
||||||
e.printStackTrace()
|
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}"
|
tagName "v${mc_version}-${mod_version}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user