new python build-deploy chain

This commit is contained in:
Mikkeli Matlock
2026-01-25 00:34:01 +09:00
parent 42e2094635
commit 754cecffd4
8 changed files with 532 additions and 24 deletions

64
scripts/build-deploy.py Normal file
View File

@@ -0,0 +1,64 @@
#!/usr/bin/env python3
"""One-click build and deploy for Smart Serow.
Combines build.py and deploy.py with sensible defaults.
Defaults to --restart since that's usually what you want.
"""
import argparse
import sys
from pathlib import Path
# Import sibling modules
sys.path.insert(0, str(Path(__file__).parent))
from build import build
from deploy import deploy
def main():
parser = argparse.ArgumentParser(
description="Build and deploy Smart Serow in one step",
)
parser.add_argument(
"--clean", "-c",
action="store_true",
help="Clean CMake cache before building",
)
parser.add_argument(
"--no-restart",
action="store_true",
help="Don't restart service after deploy (default: restart)",
)
parser.add_argument(
"--build-only",
action="store_true",
help="Only build, don't deploy",
)
parser.add_argument(
"--deploy-only",
action="store_true",
help="Only deploy, don't build",
)
args = parser.parse_args()
# Build
if not args.deploy_only:
print()
if not build(clean=args.clean):
print("Build failed!")
sys.exit(1)
# Deploy
if not args.build_only:
print()
restart = not args.no_restart
if not deploy(restart=restart):
print("Deploy failed!")
sys.exit(1)
print()
print("=== All done! ===")
if __name__ == "__main__":
main()