bundles/sshmon: ignore prereleases and drafts

This commit is contained in:
Franzi 2022-02-17 18:08:02 +01:00
parent 19207649dd
commit 1f6520ac02
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -37,9 +37,10 @@ try:
for i in releases: for i in releases:
if i["tag_name"].startswith(tag_prefix): if i["tag_name"].startswith(tag_prefix):
if newest_release is None or parse(i["tag_name"]) > parse( if (
newest_release["tag_name"] newest_release is None
): or parse(i["tag_name"]) > parse(newest_release["tag_name"])
) and not (i["prerelease"] or i["draft"]):
newest_release = i newest_release = i
assert newest_release is not None, "Could not determine latest release" assert newest_release is not None, "Could not determine latest release"
@ -50,16 +51,13 @@ try:
newest_release["tag_name"], current_version newest_release["tag_name"], current_version
) )
) )
if newest_release["prerelease"] or newest_release["draft"]:
print("Please note this is only a prerelease/draft.")
# Don't alert people for prereleases.
exit(0)
else:
exit(2) exit(2)
else: else:
print("Currently installed version {} matches newest release on github".format(current_version)) print(
"Currently installed version {} matches newest release on github".format(
current_version
)
)
exit(0) exit(0)
except Exception as e: except Exception as e:
print(repr(e)) print(repr(e))