Skip to content

Commit

Permalink
Fix git last tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Edivad99 committed Oct 17, 2023
1 parent 5a47c84 commit c2955f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@ mixin {
}

def penultimateTag = { ->
final defaultTag = 'cbe30d7fab88e74ddf748ddb3dcf0112b7e645d3'
def stdout = new ByteArrayOutputStream()
try {
var tags = 'git tag --list --sort=-creatordate'.execute().text.split("\n")
return tags.length > 1 ? tags[1] : defaultTag
project.exec { ExecSpec spec ->
spec.commandLine('git', 'describe', '--abbrev=0', '--tags', 'HEAD~').standardOutput(stdout)
}.assertNormalExitValue().rethrowFailure()
} catch (Exception e) {
return defaultTag
throw new IllegalStateException("Failed to get the tag; check if 'git' is on the PATH", e)
}
return stdout.toString()
}

tasks.register('makeChangelog', GitChangelogTask) {
Expand Down

0 comments on commit c2955f8

Please sign in to comment.