Configuration changes
All checks were successful
Build Docker Image / build (push) Successful in 26s

This commit is contained in:
2025-11-30 13:56:27 -06:00
parent 1b9c390ea2
commit 3db532de6f
3 changed files with 24 additions and 10 deletions

14
main.py
View File

@@ -18,7 +18,7 @@ apps = {
},
"electrs": {
"name": "electrs",
"url": "https://api.github.com/repos/romanz/electrs/releases/latest"
"url": "https://api.github.com/repos/romanz/electrs/releases/latest",
}
}
@@ -84,7 +84,7 @@ class Autopkg:
pre_release = json["prerelease"]
# Package new versions if available
api_tag_higher = is_tag_higher(api_tag, data_tag, info)
api_tag_higher = is_tag_higher(api_tag, data_tag, info["versioningScheme"])
if not pre_release and api_tag_higher[0]:
logging.info(f"Found new version ({api_tag}) for {app_name}, packaging..")
@@ -102,25 +102,25 @@ class Autopkg:
logging.error(f"Failed to ping {app_name}'s API.")
def is_tag_higher(api_tag: str, data_tag: list, data_info: dict) -> tuple:
def is_tag_higher(api_tag: str, data_tag: list, data_scheme: str) -> tuple:
regular_scheme = r"^v(\d+)\.(\d+)\.(\d+)$"
# Derive version from API tag
try:
version = re.match(data_info, api_tag)
version = re.match(data_scheme, api_tag)
except:
version = re.match(regular_scheme, api_tag)
if not version:
logging.warning(f"New tag for {app_info["name"]} doesn't follow versioning schemes, ignoring..")
logging.warning(f"New tag for {data_info["name"]} doesn't follow versioning schemes, ignoring..")
return (False)
return (False,)
# Compare versions
re_tag = map(int, version.groups())
is_higher = tuple(map(lambda a, b: a >= b, re_tag, data_tag))
return (True, re_tag) if all(is_higher) else (False)
return (True, re_tag) if all(is_higher) else (False,)
if __name__ == "__main__":