Skip to content

Commit 76d2e78

Browse files
committed
Added script to create proper release branch
1 parent 0a3c08a commit 76d2e78

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""
2+
This script automates the creation of a release branch for the NGO package.
3+
4+
It performs the following steps:
5+
1. Creates a new release branch named 'release/<version>'.
6+
2. Executes the release.py script that prepares branch for release by
7+
updating changelog and ValidationExceptions.
8+
3. Commits all changes made by the script.
9+
4. Pushes the new branch to the remote repository.
10+
"""
11+
#!/usr/bin/env python3
12+
import sys
13+
import os
14+
15+
UTILS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../Utils'))
16+
sys.path.insert(0, UTILS_DIR)
17+
from general_utils import get_package_version_from_manifest # nopep8
18+
from git_utils import create_branch_execute_commands_and_push # nopep8
19+
from config import getPackageManifestPath, getNetcodeReleaseBranchName, getNetcodeGithubRepo # nopep8
20+
21+
def createToolsReleaseBranch():
22+
"""
23+
Creates a new release branch for the NGO package.
24+
It also runs release.py script that prepares the branch for release by updating the changelog, ValidationExceptions etc
25+
"""
26+
27+
ngo_manifest_path = getPackageManifestPath()
28+
ngo_package_version = get_package_version_from_manifest(ngo_manifest_path)
29+
ngo_github_repo = getNetcodeGithubRepo()
30+
ngo_release_branch_name = getNetcodeReleaseBranchName(ngo_package_version)
31+
ngo_github_token = os.environ.get("GITHUB_TOKEN")
32+
33+
if not os.path.exists(ngo_manifest_path):
34+
print(f" Path does not exist: {ngo_manifest_path}")
35+
sys.exit(1)
36+
37+
if ngo_package_version is None:
38+
print(f"Package version not found at {ngo_manifest_path}")
39+
sys.exit(1)
40+
41+
if not ngo_github_token:
42+
print("Error: GITHUB_TOKEN environment variable not set.", file=sys.stderr)
43+
sys.exit(1)
44+
45+
commit_message = f"Preparing Netcode package of version {ngo_package_version} for the release"
46+
command_to_run_on_release_branch = ['python', 'Tools/scripts/release.py']
47+
48+
create_branch_execute_commands_and_push(ngo_github_token, ngo_github_repo, ngo_release_branch_name, commit_message, command_to_run_on_release_branch)
49+
50+
51+
52+
if __name__ == "__main__":
53+
createToolsReleaseBranch()

0 commit comments

Comments
 (0)