mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-21 07:49:13 +00:00
build: adjust version meta for release builds
This commit is contained in:
17
build.gradle
17
build.gradle
@@ -168,11 +168,20 @@ logger.lifecycle("Building HuskSync ${version} by William278")
|
|||||||
|
|
||||||
@SuppressWarnings('GrMethodMayBeStatic')
|
@SuppressWarnings('GrMethodMayBeStatic')
|
||||||
def versionMetadata() {
|
def versionMetadata() {
|
||||||
// Get the last commit hash and if it's a clean head
|
// Require grgit
|
||||||
if (grgit == null) {
|
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 }
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user