diff options
author | Andrew Dolgov <[email protected]> | 2023-04-10 22:29:36 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-04-10 22:29:36 +0300 |
commit | 0fef52be0a4adbfe3a7b092f355dd78d0f4855d6 (patch) | |
tree | 8e67600493e2b25cac358728181a783202289a21 /classes/config.php | |
parent | e6475b522f817256333af7d34c808088ea4ab86e (diff) |
get version from CI variables, rebase to php 8.1 & alpine 3.16
Diffstat (limited to 'classes/config.php')
-rw-r--r-- | classes/config.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/classes/config.php b/classes/config.php index 2fec4e0..8f7cbec 100644 --- a/classes/config.php +++ b/classes/config.php @@ -77,8 +77,16 @@ class Config { if (empty($this->version)) { $this->version["status"] = -1; - if (PHP_OS === "Darwin") { - $ttrss_version["version"] = "UNKNOWN (Unsupported, Darwin)"; + if (getenv("CI_COMMIT_SHORT_SHA") && getenv("CI_COMMIT_TIMESTAMP")) { + + $this->version["branch"] = getenv("CI_COMMIT_BRANCH"); + $this->version["timestamp"] = strtotime(getenv("CI_COMMIT_TIMESTAMP")); + $this->version["version"] = sprintf("%s-%s", date("y.m", $this->version["timestamp"]), getenv("CI_COMMIT_SHORT_SHA")); + $this->version["commit"] = getenv("CI_COMMIT_SHORT_SHA"); + $this->version["status"] = 0; + + } else if (PHP_OS === "Darwin") { + $this->version["version"] = "UNKNOWN (Unsupported, Darwin)"; } else if (file_exists("$root_dir/version_static.txt")) { $this->version["version"] = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)"; } else if (is_dir("$root_dir/.git")) { @@ -108,6 +116,7 @@ class Config { "status" => -1, "version" => "", "commit" => "", + "branch" => "", "timestamp" => 0, ]; |