feat(deploy): add declarative installation workflow
Some checks failed
Dependency Audit / dependency-audit (push) Has been cancelled
Deployment Installer / deployment-installer (push) Has been cancelled
Security Audit / security-audit (push) Has been cancelled

This commit is contained in:
2026-07-30 15:36:37 +02:00
parent fcb8296812
commit 82e836b720
15 changed files with 3654 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
#!/usr/bin/env python3
"""Build the dependency-free GovOPlaN deployer as one executable zipapp."""
from __future__ import annotations
import argparse
from hashlib import sha256
from pathlib import Path
import zipapp
ROOT = Path(__file__).resolve().parent
DEFAULT_OUTPUT = ROOT.parent.parent / "runtime" / "deployment" / "govoplan-deploy.pyz"
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--output", type=Path, default=DEFAULT_OUTPUT)
args = parser.parse_args(argv)
output = args.output.expanduser().resolve()
if output == ROOT or ROOT in output.parents:
raise SystemExit("output must be outside the deployment source directory")
output.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
temporary = output.with_name(f".{output.name}.tmp")
if temporary.exists():
temporary.unlink()
zipapp.create_archive(
ROOT,
target=temporary,
interpreter="/usr/bin/env python3",
compressed=True,
filter=_include_source,
)
temporary.chmod(0o755)
temporary.replace(output)
digest = sha256(output.read_bytes()).hexdigest()
print(f"{digest} {output}")
return 0
def _include_source(path: Path) -> bool:
return (
"__pycache__" not in path.parts
and path.suffix not in {".pyc", ".pyo"}
and path.name != "build-deployer-zipapp.py"
)
if __name__ == "__main__":
raise SystemExit(main())