From 081a77a6e97cc96990246bf11dc11a4edac63e1b Mon Sep 17 00:00:00 2001 From: William Date: Tue, 20 Sep 2022 17:55:47 +0100 Subject: [PATCH] [ci-skip] Detect tagged commit heads in `versionMetadata()` --- build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.gradle b/build.gradle index 77e76ec2..1d9db188 100644 --- a/build.gradle +++ b/build.gradle @@ -105,6 +105,13 @@ logger.lifecycle("Building HuskHomes ${version} by William278") @SuppressWarnings('GrMethodMayBeStatic') def versionMetadata() { + // Get if there is a tag for this commit + def tag = grgit.tag.list().find { it.commit.id == grgit.head().id } + if (tag != null) { + return '' + } + + // Otherwise, get the last commit hash and if it's a clean head if (grgit == null) { return System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown' }