diff options
author | 3gg <3gg@shellblade.net> | 2025-08-30 16:53:58 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2025-08-30 16:53:58 -0700 |
commit | 6aaedb813fa11ba0679c3051bc2eb28646b9506c (patch) | |
tree | 34acbfc9840e02cb4753e6306ea7ce978bf8b58e /src/contrib/SDL-3.2.20/build-scripts/create-release.py | |
parent | 8f228ade99dd3d4c8da9b78ade1815c9adf85c8f (diff) |
Update to SDL3
Diffstat (limited to 'src/contrib/SDL-3.2.20/build-scripts/create-release.py')
-rwxr-xr-x | src/contrib/SDL-3.2.20/build-scripts/create-release.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/build-scripts/create-release.py b/src/contrib/SDL-3.2.20/build-scripts/create-release.py new file mode 100755 index 0000000..14916fa --- /dev/null +++ b/src/contrib/SDL-3.2.20/build-scripts/create-release.py | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | |||
3 | import argparse | ||
4 | from pathlib import Path | ||
5 | import json | ||
6 | import logging | ||
7 | import re | ||
8 | import subprocess | ||
9 | |||
10 | ROOT = Path(__file__).resolve().parents[1] | ||
11 | |||
12 | |||
13 | def determine_remote() -> str: | ||
14 | text = (ROOT / "build-scripts/release-info.json").read_text() | ||
15 | release_info = json.loads(text) | ||
16 | if "remote" in release_info: | ||
17 | return release_info["remote"] | ||
18 | project_with_version = release_info["name"] | ||
19 | project, _ = re.subn("([^a-zA-Z_])", "", project_with_version) | ||
20 | return f"libsdl-org/{project}" | ||
21 | |||
22 | |||
23 | def main(): | ||
24 | default_remote = determine_remote() | ||
25 | |||
26 | parser = argparse.ArgumentParser(allow_abbrev=False) | ||
27 | parser.add_argument("--ref", required=True, help=f"Name of branch or tag containing release.yml") | ||
28 | parser.add_argument("--remote", "-R", default=default_remote, help=f"Remote repo (default={default_remote})") | ||
29 | parser.add_argument("--commit", help=f"Input 'commit' of release.yml (default is the hash of the ref)") | ||
30 | args = parser.parse_args() | ||
31 | |||
32 | if args.commit is None: | ||
33 | args.commit = subprocess.check_output(["git", "rev-parse", args.ref], cwd=ROOT, text=True).strip() | ||
34 | |||
35 | |||
36 | print(f"Running release.yml workflow:") | ||
37 | print(f" remote = {args.remote}") | ||
38 | print(f" ref = {args.ref}") | ||
39 | print(f" commit = {args.commit}") | ||
40 | |||
41 | subprocess.check_call(["gh", "-R", args.remote, "workflow", "run", "release.yml", "--ref", args.ref, "-f", f"commit={args.commit}"], cwd=ROOT) | ||
42 | |||
43 | |||
44 | if __name__ == "__main__": | ||
45 | raise SystemExit(main()) | ||