Skip to content

Commit 0a550f3

Browse files
committed
corrected UpdateChangelog logic
1 parent ab271af commit 0a550f3

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

Tools/scripts/ReleaseAutomation/commitNetcodeChangelogAndPackageVersionUpdates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def updateNetcodeChangelogAndPackageVersionAndPush():
6969
repo.git.pull("origin", ngo_default_repo_branch_to_push_to)
7070

7171
# Update the changelog file with adding new [Unreleased] section
72-
update_changelog(ngo_package_version, ngo_package_name, add_unreleased_template=True)
72+
update_changelog(ngo_changelog_path, ngo_package_version, ngo_package_name, add_unreleased_template=True)
7373
# Update the package version by patch to represent the "current package state" after release
7474
update_package_version_by_patch(ngo_manifest_path)
7575

Tools/scripts/ReleaseAutomation/triggerYamatoJobsForNetcodeReleaseValidation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def trigger_automated_builds_job_on_yamato(yamato_api_token, project_id, branch_
126126

127127

128128
def trigger_NGO_release_preparation_jobs():
129-
"""Triggers Wrench dry run promotion josb and build automation for anticipation for Playtesting and Packageworks setup for NGO."""
129+
"""Triggers Wrench dry run promotion jobs and build automation for anticipation for Playtesting and Packageworks setup for NGO."""
130130

131131
samples_to_build = [
132132
{

Tools/scripts/Utils/general_utils.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import re
66
import datetime
77

8-
from config import getPackageChangelogPath
9-
108
UNRELEASED_CHANGELOG_SECTION_TEMPLATE = r"""
119
## [Unreleased]
1210
@@ -108,7 +106,7 @@ def update_validation_exceptions(validation_file, package_version):
108106
json_file.write("\n") # Add newline cause Py JSON does not
109107
print(f" updated `{validation_file}`")
110108

111-
def update_changelog(new_version, add_unreleased_template=False):
109+
def update_changelog(changelog_path, new_version, add_unreleased_template=False):
112110
"""
113111
Cleans the [Unreleased] section of the changelog by removing empty subsections,
114112
then replaces the '[Unreleased]' tag with the new version and release date.
@@ -123,11 +121,6 @@ def update_changelog(new_version, add_unreleased_template=False):
123121

124122
new_changelog_entry = f'## [{new_version}] - {datetime.date.today().isoformat()}'
125123
version_header_to_find_if_exists = f'## [{new_version}]'
126-
changelog_path = getPackageChangelogPath()
127-
128-
if not os.path.exists(changelog_path):
129-
print("CHANGELOG path is incorrect, the script will terminate without updating the CHANGELOG")
130-
return None
131124

132125
with open(changelog_path, 'r', encoding='UTF-8') as f:
133126
changelog_text = f.read()
@@ -169,5 +162,3 @@ def update_changelog(new_version, add_unreleased_template=False):
169162
# Write the changes
170163
with open(changelog_path, 'w', encoding='UTF-8') as file:
171164
file.write(final_content)
172-
173-
return final_content

Tools/scripts/release.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@
1212
UTILS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), './Utils'))
1313
sys.path.insert(0, UTILS_DIR)
1414
from general_utils import get_package_version_from_manifest, update_changelog, update_validation_exceptions # nopep8
15-
from config import getNetcodePackageName, getPackageManifestPath, getPackageValidationExceptionsPath # nopep8
15+
from config import getNetcodePackageName, getPackageManifestPath, getPackageValidationExceptionsPath, getPackageChangelogPath # nopep8
1616

1717
if __name__ == '__main__':
1818

1919
ngo_package_name = getNetcodePackageName()
2020
ngo_manifest_path = getPackageManifestPath()
2121
ngo_validation_exceptions_path = getPackageValidationExceptionsPath()
22-
ngo_package_version = get_package_version_from_manifest(ngo_manifest_path)
22+
ngo_changelog_path = getPackageChangelogPath()
2323

2424
if not os.path.exists(ngo_manifest_path):
2525
print(f" Path does not exist: {ngo_manifest_path}")
2626
sys.exit(1)
2727

28+
if not os.path.exists(ngo_changelog_path):
29+
print(f" Path CHANGELOG does not exist: {ngo_changelog_path}")
30+
sys.exit(1)
31+
32+
ngo_package_version = get_package_version_from_manifest(ngo_manifest_path)
33+
2834
if ngo_package_version is None:
2935
print(f"Package version not found at {ngo_manifest_path}")
3036
sys.exit(1)
@@ -34,4 +40,4 @@
3440
update_validation_exceptions(ngo_validation_exceptions_path, ngo_package_version)
3541
# Clean the CHANGELOG and add latest entry
3642
# package version is already know as is always corresponds to current package state
37-
update_changelog(ngo_package_version)
43+
update_changelog(ngo_changelog_path, ngo_package_version)

0 commit comments

Comments
 (0)