Configuration changes
All checks were successful
Build Docker Image / build (push) Successful in 26s
All checks were successful
Build Docker Image / build (push) Successful in 26s
This commit is contained in:
17
autopkg.ini
Normal file
17
autopkg.ini
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
; [appname]
|
||||||
|
; name = App name
|
||||||
|
; api = Git releases API link
|
||||||
|
; hash = SHA256 hash of binary
|
||||||
|
; scheme = Regex version matching scheme
|
||||||
|
|
||||||
|
[apps.bitcoinknots]
|
||||||
|
name = Bitcoin Knots
|
||||||
|
api = https://api.github.com/repos/bitcoinknots/bitcoin/releases/latest
|
||||||
|
hash =
|
||||||
|
scheme = ^v(\d+)\.(\d+)\.knots(\d{8})$
|
||||||
|
|
||||||
|
[apps.electrs]
|
||||||
|
name = electrs
|
||||||
|
api = https://api.github.com/repos/romanz/electrs/releases/latest
|
||||||
|
hash =
|
||||||
|
scheme =
|
||||||
14
main.py
14
main.py
@@ -18,7 +18,7 @@ apps = {
|
|||||||
},
|
},
|
||||||
"electrs": {
|
"electrs": {
|
||||||
"name": "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"]
|
pre_release = json["prerelease"]
|
||||||
|
|
||||||
# Package new versions if available
|
# 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]:
|
if not pre_release and api_tag_higher[0]:
|
||||||
logging.info(f"Found new version ({api_tag}) for {app_name}, packaging..")
|
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.")
|
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+)$"
|
regular_scheme = r"^v(\d+)\.(\d+)\.(\d+)$"
|
||||||
|
|
||||||
# Derive version from API tag
|
# Derive version from API tag
|
||||||
try:
|
try:
|
||||||
version = re.match(data_info, api_tag)
|
version = re.match(data_scheme, api_tag)
|
||||||
except:
|
except:
|
||||||
version = re.match(regular_scheme, api_tag)
|
version = re.match(regular_scheme, api_tag)
|
||||||
|
|
||||||
if not version:
|
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
|
# Compare versions
|
||||||
re_tag = map(int, version.groups())
|
re_tag = map(int, version.groups())
|
||||||
is_higher = tuple(map(lambda a, b: a >= b, re_tag, data_tag))
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user