blob: e1d6d9c670dbe4abb0e9455c33592d19953a53ad [file] [log] [blame]
Chih-Hung Hsiehfab43802020-04-07 14:24:01 -07001#!/usr/bin/env python3
2
3import os
4import shutil
5import subprocess
6
7TARGET = ".docs"
8VERSION = "clang_9_0"
9
10if os.path.isdir(TARGET):
11 shutil.rmtree(TARGET)
12
13os.mkdir(TARGET)
14
15for (name, features) in [("default", VERSION), ("runtime", f"runtime,{VERSION}")]:
16 subprocess.call(["cargo", "clean"])
17 subprocess.call(["cargo", "doc", f"--features={features}", "--no-deps"])
18 print(f"Copying docs to {TARGET}/{name}...")
19 shutil.copytree(f"target/doc", f"{TARGET}/{name}")
20
21os.chdir(TARGET)
22subprocess.call(["git", "init"])
23subprocess.call(["git", "remote", "add", "origin", "git@github.com:KyleMayes/clang-sys.git"])
24subprocess.call(["git", "checkout", "--orphan", "gh-pages"])
25subprocess.call(["git", "add", "-A"])
26subprocess.call(["git", "commit", "-m", "\"Update documentation\""])
27subprocess.call(["git", "push", "origin", "gh-pages", "--force"])
28
29os.chdir("..")
30shutil.rmtree(TARGET)