Skip to content

Commit

Permalink
build: adjust version meta for release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed May 6, 2024
1 parent a3b50a0 commit 75f8bee
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,20 @@ logger.lifecycle("Building HuskSync ${version} by William278")

@SuppressWarnings('GrMethodMayBeStatic')
def versionMetadata() {
// Get the last commit hash and if it's a clean head
// Require grgit
if (grgit == null) {
return '-' + System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
return '-unknown'
}
// If grgit DOES exist, get tag for this commit

// If unclean, return the last commit hash with -indev
if (!grgit.status().clean) {
return '-' + grgit.head().abbreviatedId + '-indev'
}

// Otherwise if this matches a tag, return nothing
def tag = grgit.tag.list().find { it.commit.id == grgit.head().id }
return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
if (tag != null) {
return ''
}
return '-' + grgit.head().abbreviatedId
}

0 comments on commit 75f8bee

Please sign in to comment.