Pārlūkot izejas kodu

Ajout d'un script de déploiement

master
Dimitri Merejkowsky pirms 4 gadiem
vecāks
revīzija
a769a81a81
1 mainītis faili ar 36 papildinājumiem un 0 dzēšanām
  1. +36
    -0
      cours/deploy.py

+ 36
- 0
cours/deploy.py Parādīt failu

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