Skip to content

Commit

Permalink
Add Git hash to build name
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz committed Mar 22, 2019
1 parent a5f2e6a commit 90488d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ else {
def DISTRIBUTION_DIR = file("dist")
def PATH_IN_ZIP = "${project.name}"

def getGitHash = {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}

repositories {
mavenCentral()
}
Expand All @@ -52,7 +61,7 @@ dependencies {
}

task buildExtension (type: Zip, overwrite: true) {
baseName "${project.name}".replace(' ', '_') + "-${project.version}"
baseName "${project.name}".replace(' ', '_') + "-${project.version}-${getGitHash()}"
extension 'zip'
destinationDir DISTRIBUTION_DIR
version ''
Expand Down

0 comments on commit 90488d4

Please sign in to comment.