Skip to content

Commit 0177f92

Browse files
committed
custom commit message
1 parent 6d0f8bb commit 0177f92

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

build.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ def clone(branch: str, tmp_dir: str) -> None:
2626
)
2727

2828

29+
def get_commit_hash(tmp_dir: str) -> str:
30+
ps = subprocess.run(["git", "rev-parse", "--short", "HEAD"], cwd=tmp_dir, capture_output=True)
31+
if ps.returncode != 0:
32+
raise SystemExit(ps.returncode)
33+
return ps.stdout.decode("utf-8").strip()
34+
35+
2936
def build_manpages(tmp_dir: str):
3037
if return_code := subprocess.run(["sh", "config"], cwd=tmp_dir).returncode != 0:
3138
raise SystemExit(return_code)
@@ -72,8 +79,9 @@ def copy_images(tmp_dir: str):
7279
shutil.copytree(f"{tmp_dir}/doc/man7/img", "docs/man7/img")
7380

7481

75-
def build_site(version: str):
76-
return subprocess.run(["mike", "deploy", version]).returncode
82+
def build_site(commit: str, version: str):
83+
commit_msg = f"deploy openssl/openssl@{commit} to {version}"
84+
return subprocess.run(["mike", "deploy", "-m", commit_msg, version]).returncode
7785

7886

7987
def main():
@@ -83,12 +91,13 @@ def main():
8391
create_dirs()
8492
with tempfile.TemporaryDirectory() as tmp_dir:
8593
clone(branch, tmp_dir)
94+
commit = get_commit_hash(tmp_dir)
8695
if version not in ["1.0.2", "1.1.1"]:
8796
build_manpages(tmp_dir)
8897
convert_pod_to_md(tmp_dir)
8998
if version not in ["1.0.2", "1.1.1"]:
9099
copy_images(tmp_dir)
91-
return build_site(version)
100+
return build_site(commit, version)
92101

93102

94103
if __name__ == "__main__":

0 commit comments

Comments
 (0)