diff --git a/build.gradle.kts b/build.gradle.kts index a3ed92e..5e4fb03 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import java.io.ByteArrayOutputStream plugins { id("java") @@ -6,7 +7,7 @@ plugins { } group = "com.alttd" -version = "2.1.6" +version = System.getenv("BUILD_NUMBER") ?: gitCommit() description = "Altitude AFK Detector plugin." apply() @@ -45,4 +46,14 @@ tasks { dependencies { implementation("com.alttd:Galaxy-API:1.20.4-R0.1-SNAPSHOT") compileOnly("de.keyle:mypet:3.11-SNAPSHOT") +} + +fun gitCommit(): String { + val os = ByteArrayOutputStream() + project.exec { + isIgnoreExitValue = true + commandLine = "git rev-parse --short HEAD".split(" ") + standardOutput = os + } + return String(os.toByteArray()).trim() } \ No newline at end of file