加一点信息

This commit is contained in:
shenjack 2024-04-20 22:53:42 +08:00
parent a661d55d1f
commit 2afdabfd63
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -51,11 +51,13 @@ def get_env_info() -> dict[str, str]:
env_info["message"] = message.stdout.strip() env_info["message"] = message.stdout.strip()
# git tag # git tag
if ON_CF: if ON_CF:
tag = "cf_pages" tag = "cf_pages" or run(
["git", "describe", "--tags"], capture_output=True, text=True, encoding="utf-8"
).stdout.split("-")[0]
else: else:
tag = run( tag = run(
["git", "describe", "--tags"], capture_output=True, text=True, encoding="utf-8" ["git", "describe", "--tags"], capture_output=True, text=True, encoding="utf-8"
).stdout ).stdout.split("-")[0]
env_info["tag"] = tag.strip() env_info["tag"] = tag.strip()
return env_info return env_info
@ -94,7 +96,7 @@ if __name__ == "__main__":
border = border_template.format(f"#{hash_color:06x}") border = border_template.format(f"#{hash_color:06x}")
# git 信息: # git 信息:
version_info = f"{file_branch_name}/{branch}:{tag}<br/>{message}" version_info = f"{file_branch_name}/{branch}:{tag}-{commit[:6]}<br/>{message}"
marker = marker_template.format(version_info) marker = marker_template.format(version_info)
print(f"Branch: {file_branch_name}\n{border}\n{marker}\n") print(f"Branch: {file_branch_name}\n{border}\n{marker}\n")
@ -104,7 +106,7 @@ if __name__ == "__main__":
border = border_template.format("greenyellow") border = border_template.format("greenyellow")
# git 信息: # git 信息:
version_info = f"{branch}:{tag}" version_info = f"{branch}:{tag}-{commit[:6]}"
marker = marker_template.format(version_info) marker = marker_template.format(version_info)
print(f"Master: {border}\n{marker}\n") print(f"Master: {border}\n{marker}\n")