Add a verified single-server web update workflow
This commit is contained in:
1 parent
7c69c65d36
commit
b7a156b45e
12 files changed
+1007
-1
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Describe a reviewed wheel for the web updater."
|
||||
)
|
||||
parser.add_argument("wheel", type=Path)
|
||||
parser.add_argument("upgrade_from", nargs="+")
|
||||
args = parser.parse_args()
|
||||
version_pattern = r"\d+\.\d+\.\d+(?:rc\d+)?"
|
||||
match = re.fullmatch(
|
||||
rf"coulobre_panel-({version_pattern})-py3-none-any\.whl",
|
||||
args.wheel.name,
|
||||
)
|
||||
if match is None or any(
|
||||
not re.fullmatch(version_pattern, item) for item in args.upgrade_from
|
||||
):
|
||||
parser.error("Use a Coulobre wheel and the tested installed versions.")
|
||||
with args.wheel.open("rb") as wheel:
|
||||
checksum = hashlib.file_digest(wheel, "sha256").hexdigest()
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
"schema": 1,
|
||||
"version": match[1],
|
||||
"upgrade_from": args.upgrade_from,
|
||||
"sha256": checksum,
|
||||
},
|
||||
indent=2,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user