From a769a81a819ebe78db7436e76b1e2b8b262b995b Mon Sep 17 00:00:00 2001 From: Dimitri Merejkowsky Date: Sat, 5 Sep 2020 12:44:18 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20script=20de=20d=C3=A9ploiement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cours/deploy.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cours/deploy.py diff --git a/cours/deploy.py b/cours/deploy.py new file mode 100644 index 0000000..3b3ae4d --- /dev/null +++ b/cours/deploy.py @@ -0,0 +1,36 @@ +import argparse +import subprocess + + +def deploy(*, dry_run): + cmd = [ + "rsync", + "--itemize-changes", + "--recursive", + "build/html/", + "dedi3:/srv/nginx/html/python", + ] + if dry_run: + cmd.append("--dry-run") + print(*cmd) + subprocess.run(cmd, check=True) + + cmd = [ + "scp", + "build/latex/programmationenpython.pdf", + "dedi3:/srv/nginx/html/python/cours-python.pdf", + ] + print(*cmd) + if not dry_run: + subprocess.run(cmd, check=True) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--dry-run", action="store_true") + args = parser.parse_args() + deploy(dry_run=args.dry_run) + + +if __name__ == "__main__": + main()