diff --git a/build.gradle b/build.gradle index 8a9bd2d..f266c49 100644 --- a/build.gradle +++ b/build.gradle @@ -5,11 +5,11 @@ plugins { id 'maven-publish' // for jitpack.io } -String group = System.getenv('GROUP') ?: properties['group'] -String version = System.getenv('VERSION') ?: properties['version'] +String group = System.getenv("GROUP") ?: properties["group"] +String commitHash = ""; rootProject.group = group -rootProject.version = version +rootProject.version = properties["version"] + "." + commitHash repositories { mavenCentral() @@ -100,6 +100,17 @@ tasks.named('deploy').configure { dependsOn jar } +tasks.register('getGitCommitHash') { + doLast { + def ch = 'git rev-parse --short HEAD'.execute().text.trim() + commitHash = ch + } +} + +tasks.named("build").configure { + dependsOn getGitCommitHash +} + wrapper { gradleVersion = '8.9' distributionType = Wrapper.DistributionType.BIN diff --git a/gradle.properties b/gradle.properties index 11d3301..2f36118 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ org.gradle.vfs.watch = false # Other properties name = TheBase group = com.github.server-utilities -version = 1.0-SNAPSHOT \ No newline at end of file +version = 1.0 \ No newline at end of file