-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.py
44 lines (30 loc) · 1.02 KB
/
release.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import subprocess
import time
import toml
def main():
with open("pyproject.toml", "r") as f:
pyproject_toml = toml.load(f)
version = pyproject_toml["project"]["version"]
with open("Cargo.toml", "r") as f:
cargo_toml = toml.load(f)
cargo_toml["package"]["version"] = version
with open("Cargo.toml", "w") as f:
toml.dump(cargo_toml, f)
print("waiting for cargo.lock to update")
time.sleep(2)
print("committing version changes")
subprocess.run(["git", "commit", "-am", version], check=True)
print("pushing to remote")
subprocess.run(["git", "push", "origin"], check=True)
time.sleep(2)
print("creating release")
subprocess.run(
["gh", "release", "create", f"v{version}", "--generate-notes"], check=True
)
print("compiling docs")
subprocess.run(
["mike", "deploy", "--push", "--update-aliases", f"{version}", "latest"]
)
subprocess.run(["mike", "set-default", "--push", "latest"])
if __name__ == "__main__":
main()