Skip to content

Commit

Permalink
add logic to optional tag value
Browse files Browse the repository at this point in the history
  • Loading branch information
Dert1129 committed Feb 14, 2024
1 parent df6280b commit 62fd89d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ plugins {
group = 'kingstonduo'

def getCurrentGitBranch() {
def gitBranch = "Unknown branch"
try {
if (project.hasProperty('tag')) {
def tagValue = project.property('tag')
return tagValue
} else {
def gitBranch = "Unknown branch"
try {
def workingDir = new File("${project.projectDir}")
def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() == 0) {
gitBranch = result.text.trim()
}
} catch (e) {
} catch (e) {
}
return gitBranch
}
return gitBranch
}


Expand Down

0 comments on commit 62fd89d

Please sign in to comment.