Browse Source

Ajout d'un script de déploiement

master
Dimitri Merejkowsky 3 years ago
parent
commit
a769a81a81
1 changed files with 36 additions and 0 deletions
  1. +36
    -0
      cours/deploy.py

+ 36
- 0
cours/deploy.py View File

@@ -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()