Skip to content

Commit d1fb582

Browse files
committed
Added wrench regeneration step to the release automation
1 parent ea72c47 commit d1fb582

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

Tools/scripts/Utils/general_utils.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,42 @@ def update_package_version_by_patch(package_manifest_path):
7575
return new_package_version
7676

7777

78+
def regenerate_wrench():
79+
"""
80+
It runs Tools/regenerate-ci.cmd OR Tools/regenerate-ci.sh script
81+
to regenerate the CI files. (depending on the OS)
82+
83+
This is needed because wrench scripts content is created dynamically depending on the available editors
84+
"""
85+
86+
# --- Regenerate the CI files ---
87+
print("\nRegenerating CI files...")
88+
script_path = ""
89+
if platform.system() == "Windows":
90+
script_path = os.path.join('Tools', 'CI', 'regenerate-ci.bat')
91+
else: # macOS and Linux
92+
script_path = os.path.join('Tools' 'CI', 'regenerate-ci.sh')
93+
94+
if not os.path.exists(script_path):
95+
print(f"Error: Regeneration script not found at '{script_path}'.")
96+
return
97+
98+
try:
99+
# Execute the regeneration script
100+
# On non-Windows systems, the script might need execute permissions.
101+
if platform.system() != "Windows":
102+
os.chmod(script_path, 0o755)
103+
104+
print(f"Running '{script_path}'...")
105+
subprocess.run([script_path], check=True, shell=True)
106+
print("CI regeneration completed successfully.")
107+
108+
except subprocess.CalledProcessError as e:
109+
print(f"Error: The CI regeneration script failed with exit code {e.returncode}.")
110+
except Exception as e:
111+
print(f"An unexpected error occurred while running the regeneration script: {e}")
112+
113+
78114
def update_validation_exceptions(validation_file, package_version):
79115
"""
80116
Updates the ValidationExceptions.json file with the new package version.

Tools/scripts/release.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import subprocess
1414
import platform
1515

16-
from Utils.general_utils import get_package_version_from_manifest, update_changelog, update_validation_exceptions # nopep8
16+
from Utils.general_utils import get_package_version_from_manifest, update_changelog, update_validation_exceptions, regenerate_wrench # nopep8
1717

1818
def make_package_release_ready(manifest_path, changelog_path, validation_exceptions_path, package_version):
1919

@@ -36,6 +36,8 @@ def make_package_release_ready(manifest_path, changelog_path, validation_excepti
3636
# package version is already know as explained in
3737
# https://github.cds.internal.unity3d.com/unity/dots/pull/14318
3838
update_changelog(changelog_path, package_version)
39+
# Make sure that the wrench scripts are up to date
40+
regenerate_wrench()
3941

4042

4143
if __name__ == '__main__':

0 commit comments

Comments
 (0)