Try to fix version info in CI builds again
This commit is contained in:
@@ -15,8 +15,12 @@ cmd_env = {
|
||||
def run(cmd):
|
||||
return subprocess.check_output(cmd, stderr=subprocess.DEVNULL, env=cmd_env)
|
||||
|
||||
|
||||
if os.path.exists(".git") and shutil.which("git"):
|
||||
if 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)
|
||||
elif 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}"
|
||||
@@ -29,11 +33,6 @@ if os.path.exists(".git") and shutil.which("git"):
|
||||
git_tag = run(["git", "describe", "--exact-match", "--tags"]).strip().decode("ascii")
|
||||
except (subprocess.SubprocessError, OSError):
|
||||
git_tag = 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
|
||||
|
||||
Reference in New Issue
Block a user