mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
More accurate version generator in e107_make.php build script
No longer trips up on hyphens in the tagged releases
This commit is contained in:
19
.github/workflows/build-release/OsHelper.php
vendored
19
.github/workflows/build-release/OsHelper.php
vendored
@@ -10,6 +10,8 @@
|
||||
|
||||
class OsHelper
|
||||
{
|
||||
const REGEX_MATCH_GIT_DESCRIBE_TAGS = "-[0-9]+-g[0-9a-f]+";
|
||||
|
||||
/**
|
||||
* @param string $command The command to run
|
||||
* @param string $stdout Reference to the STDOUT output as a string
|
||||
@@ -56,10 +58,21 @@ class OsHelper
|
||||
$verFileVersion = array_shift($verFileVersion);
|
||||
$version = preg_replace("/^v/", "", $gitVersion);
|
||||
$versionSplit = explode("-", $version);
|
||||
if (count($versionSplit) > 1)
|
||||
$matchGitDescribeTags = self::REGEX_MATCH_GIT_DESCRIBE_TAGS;
|
||||
if (preg_match("/{$matchGitDescribeTags}$/", $version))
|
||||
{
|
||||
if (version_compare($verFileVersion, $versionSplit[0], '>')) $versionSplit[0] = $verFileVersion;
|
||||
$versionSplit[0] .= "dev";
|
||||
$increment = 1;
|
||||
if (version_compare($verFileVersion, $version, '>'))
|
||||
{
|
||||
$increment = 0;
|
||||
$versionSplit[0] = $verFileVersion;
|
||||
}
|
||||
$version = implode("-", $versionSplit);
|
||||
return preg_replace_callback("/(.*\.)([0-9]+)([^.]*)({$matchGitDescribeTags})$/",
|
||||
function ($matches) use ($increment)
|
||||
{
|
||||
return $matches[1] . ($matches[2] + $increment) . "dev" . $matches[4];
|
||||
}, $version);
|
||||
}
|
||||
return implode("-", $versionSplit);
|
||||
}
|
||||
|
@@ -379,7 +379,7 @@ class e107Build
|
||||
{
|
||||
$version = $this->version;
|
||||
|
||||
if (strpos($version, "-") !== false)
|
||||
if (preg_match("/" . OsHelper::REGEX_MATCH_GIT_DESCRIBE_TAGS . "$/", $version))
|
||||
{
|
||||
$version .= " nightly build " . date('Ymd');
|
||||
}
|
||||
|
Reference in New Issue
Block a user