Update to Alpine 3.11 and fix version info in CI builds
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import subprocess
|
||||
import shutil
|
||||
import os
|
||||
|
||||
from . import __version__
|
||||
@@ -15,7 +16,7 @@ def run(cmd):
|
||||
return subprocess.check_output(cmd, stderr=subprocess.DEVNULL, env=cmd_env)
|
||||
|
||||
|
||||
if os.path.exists(".git"):
|
||||
if os.path.exists(".git") and shutil.which("git"):
|
||||
try:
|
||||
git_revision = run(["git", "rev-parse", "HEAD"]).strip().decode("ascii")
|
||||
git_revision_url = f"https://github.com/tulir/mautrix-telegram/commit/{git_revision}"
|
||||
@@ -26,15 +27,20 @@ if os.path.exists(".git"):
|
||||
|
||||
try:
|
||||
git_tag = run(["git", "describe", "--exact-match", "--tags"]).strip().decode("ascii")
|
||||
git_tag_url = f"https://github.com/tulir/mautrix-telegram/releases/tag/{git_tag}"
|
||||
except (subprocess.SubprocessError, OSError):
|
||||
git_tag = None
|
||||
git_tag_url = None
|
||||
elif os.environ.get("CI_SERVER", "no") == "yes":
|
||||
git_revision = os.environ["CI_COMMIT_SHA"]
|
||||
git_revision_url = f"https://github.com/tulir/mautrix-telegram/commit/{git_revision}"
|
||||
git_revision = git_revision[:8]
|
||||
git_tag = os.environ.get("CI_COMMIT_TAG", None)
|
||||
else:
|
||||
git_revision = "unknown"
|
||||
git_revision_url = None
|
||||
git_tag = None
|
||||
git_tag_url = None
|
||||
|
||||
git_tag_url = (f"https://github.com/tulir/mautrix-telegram/releases/tag/{git_tag}"
|
||||
if git_tag else None)
|
||||
|
||||
if git_tag and __version__ == git_tag[1:].replace("-", ""):
|
||||
version = __version__
|
||||
|
||||
Reference in New Issue
Block a user