您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

12345678910111213141516171819202122232425262728293031323334353637
  1. import argparse
  2. import subprocess
  3. import sys
  4. def build():
  5. process = subprocess.run(["hugo"])
  6. if process.returncode != 0:
  7. sys.exit("build failed")
  8. def deploy(*, dry_run):
  9. cmd = [
  10. "rsync",
  11. "--itemize-changes",
  12. "--recursive",
  13. "--delete",
  14. "public/",
  15. "dedi3:/srv/nginx/html/books/python/",
  16. ]
  17. if dry_run:
  18. cmd += ["--dry-run"]
  19. process = subprocess.run(cmd)
  20. if process.returncode != 0:
  21. sys.exit("deployment failed")
  22. def main():
  23. parser = argparse.ArgumentParser()
  24. parser.add_argument("-n", "--dry-run", action="store_true")
  25. args = parser.parse_args()
  26. build()
  27. deploy(dry_run=args.dry_run)
  28. if __name__ == "__main__":
  29. main()