Skip to content

Commit 327169a

Browse files
committed
release.py update
1 parent 4087817 commit 327169a

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

Tools/scripts/release.py

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,42 @@
66
Note that this script NEEDS TO BE RUN FROM THE ROOT of the project.
77
"""
88
#!/usr/bin/env python3
9+
import json
910
import os
11+
import re
1012
import sys
13+
import subprocess
14+
import platform
1115

12-
UTILS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), './Utils'))
13-
sys.path.insert(0, UTILS_DIR)
14-
from general_utils import get_package_version_from_manifest, update_changelog, update_validation_exceptions # nopep8
15-
from config import getNetcodePackageName, getPackageManifestPath, getPackageValidationExceptionsPath, getPackageChangelogPath # nopep8
16+
from Utils.general_utils import get_package_version_from_manifest, update_changelog, update_validation_exceptions # nopep8
1617

17-
if __name__ == '__main__':
18-
19-
ngo_package_name = getNetcodePackageName()
20-
ngo_manifest_path = getPackageManifestPath()
21-
ngo_validation_exceptions_path = getPackageValidationExceptionsPath()
22-
ngo_changelog_path = getPackageChangelogPath()
23-
24-
if not os.path.exists(ngo_manifest_path):
25-
print(f" Path does not exist: {ngo_manifest_path}")
26-
sys.exit(1)
27-
28-
if not os.path.exists(ngo_changelog_path):
29-
print(f" Path CHANGELOG does not exist: {ngo_changelog_path}")
18+
def make_package_release_ready(manifest_path, changelog_path, validation_exceptions_path, package_version):
19+
20+
if not os.path.exists(manifest_path):
21+
print(f" Path does not exist: {manifest_path}")
3022
sys.exit(1)
3123

32-
ngo_package_version = get_package_version_from_manifest(ngo_manifest_path)
24+
if not os.path.exists(changelog_path):
25+
print(f" Path does not exist: {changelog_path}")
26+
sys.exit(1)
3327

34-
if ngo_package_version is None:
35-
print(f"Package version not found at {ngo_manifest_path}")
28+
if package_version is None:
29+
print(f"Package version not found at {manifest_path}")
3630
sys.exit(1)
3731

3832
# Update the ValidationExceptions.json file
3933
# with the new package version OR remove it if not a release branch
40-
update_validation_exceptions(ngo_validation_exceptions_path, ngo_package_version)
34+
update_validation_exceptions(validation_exceptions_path, package_version)
4135
# Clean the CHANGELOG and add latest entry
42-
# package version is already know as is always corresponds to current package state
43-
update_changelog(ngo_changelog_path, ngo_package_version)
36+
# package version is already know as explained in
37+
# https://github.cds.internal.unity3d.com/unity/dots/pull/14318
38+
update_changelog(changelog_path, package_version)
39+
40+
41+
if __name__ == '__main__':
42+
manifest_path = 'com.unity.netcode.gameobjects/package.json'
43+
changelog_path = 'com.unity.netcode.gameobjects/CHANGELOG.md'
44+
validation_exceptions_path = 'com.unity.netcode.gameobjects/ValidationExceptions.json'
45+
package_version = get_package_version_from_manifest(manifest_path)
46+
47+
make_package_release_ready(manifest_path, changelog_path, validation_exceptions_path, package_version)

0 commit comments

Comments
 (0)