Futureproof the auto updater

This commit is contained in:
Telesphoreo 2022-04-22 03:26:08 -05:00
parent 011c000a26
commit dc1a5399f7
2 changed files with 17 additions and 3 deletions

3
Jenkinsfile vendored
View file

@ -1,5 +1,8 @@
pipeline {
agent any
environment {
GITHUB_BRANCH = "${BRANCH_NAME}"
}
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5')
}

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts
index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2858823a1 100644
index c236fe5dc388f8bc0a929f1de04af94c63514208..722e2aefa279e02bfef23cda8d98210072b0ed3d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,8 +13,8 @@ plugins {
@ -19,7 +19,18 @@ index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -66,7 +66,7 @@ tasks.jar {
@@ -62,11 +62,17 @@ tasks.jar {
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
+ var gitBranch: String;
+ if (System.getenv("JENKINS_URL") == null)
+ {
+ gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
+ } else {
+ gitBranch = System.getenv("GITHUB_BRANCH")
+ }
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@ -28,7 +39,7 @@ index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
@@ -193,7 +193,7 @@ tasks.test {
@@ -193,7 +199,7 @@ tasks.test {
fun TaskContainer.registerRunTask(
name: String, block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {