feat: 버전 표기에 branch명 같이 표기

This commit is contained in:
2021-11-26 18:44:18 +09:00
parent d50c409315
commit 7f4205601d
2 changed files with 37 additions and 4 deletions
+16 -2
View File
@@ -6,12 +6,26 @@ class VersionGitDynamic
{
static function getVersion()
{
$versionTokens = [];
$command = 'git describe --long --tags';
exec($command, $output);
if (is_array($output)) {
$output = join('', $output);
$versionTokens[] = trim(join('', $output));
}
return trim($output);
$command = 'git branch --contains HEAD';
exec($command, $output);
if (is_array($output)) {
if (count($output)) {
$output = $output[1];
$versionTokens[] = trim($output, " \t\n\r\0\x0b*");
} else {
$versionTokens[] = 'unknown';
}
}
return join('-', $versionTokens);
}
static function getHash()