summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/deploy.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/deploy.py b/tools/deploy.py
new file mode 100755
index 0000000..62a4ed6
--- /dev/null
+++ b/tools/deploy.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+
+import argparse
+import subprocess
+import pathlib
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(
+ description="Use OpenSSH and rsync to deploy artifacts",
+ )
+
+ parser.add_argument(
+ "-a", "--artifacts", required=True, help="local path to artifacts folder"
+ )
+ parser.add_argument(
+ "-H", "--host", default="cloud", help="target `Host` name from ~/.ssh/config"
+ )
+ parser.add_argument(
+ "-p",
+ "--path",
+ default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/main/",
+ help="remote path to destination folder on server",
+ )
+
+ args = parser.parse_args()
+
+ subprocess.run(
+ [
+ "rsync",
+ "-av",
+ "--delete",
+ f"{str(pathlib.Path(args.artifacts))}/",
+ f"{args.host}:{args.path}",
+ ],
+ shell=False,
+ check=True,
+ )
+
+
+if __name__ == "__main__":
+ main()