Skip to content

Commit 8ec06bd

Browse files
committed
corrected command and release script
1 parent c637acd commit 8ec06bd

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.yamato/package-pack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ package_pack_-_ngo_{{ platform.name }}:
3737
variables:
3838
XRAY_PROFILE: "supported ./pvpExceptions.json"
3939
commands:
40-
- Tools\scripts\release.py # Needed to ensure that CHANGELOG is properly formatted for this test due to the fact that we have bumped package version (to properly perform vetting tests)
40+
- python Tools/scripts/release.py # Needed to ensure that CHANGELOG is properly formatted for this test due to the fact that we have bumped package version (to properly perform vetting tests)
4141
- upm-pvp pack "com.unity.netcode.gameobjects" --output upm-ci~/packages
4242
- upm-pvp xray --packages "upm-ci~/packages/com.unity.netcode.gameobjects*.tgz" --results pvp-results
4343
- upm-pvp require {% if platform.name == "win" %}"%XRAY_PROFILE%"{% else %}"$XRAY_PROFILE"{% endif %} --results pvp-results --allow-missing

.yamato/vetting-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ vetting_test:
1010
name: MP Tools - Vetting Test (Win, {{editor}} LTS)
1111
agent: { type: Unity::VM, flavor: b1.large, image: package-ci/win11:v4 }
1212
commands:
13-
- Tools\scripts\release.py # Needed to ensure that CHANGELOG is properly formatted for this test
13+
- python Tools/scripts/release.py # Needed to ensure that CHANGELOG is properly formatted for this test
1414
- npm install -g "upm-ci-utils@stable" --registry https://artifactory.prd.it.unity3d.com/artifactory/api/npm/upm-npm
1515
- unity-downloader-cli --fast --wait --unity-version {{ editor }} --components editor --arch x64
1616
- upm-ci package pack --package-path com.unity.netcode.gameobjects

Tools/scripts/release.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,25 @@
1212

1313
def update_changelog(new_version):
1414
changelog_entry = f'## [{new_version}] - {datetime.date.today().isoformat()}'
15-
15+
changelog_path = f'{package_name}/CHANGELOG.md'
1616
print(changelog_entry)
17+
18+
if not os.path.exists(changelog_path):
19+
print(f"Error: CHANGELOG.md file not found at {changelog_path}")
20+
return
1721

18-
changelog_path = f'{package_name}/CHANGELOG.md'
1922
with open(changelog_path, 'rb') as f:
2023
changelog_text = f.read()
21-
22-
changelog_text = re.sub(br'## \[Unreleased\]', bytes(changelog_entry, 'UTF-8'), changelog_text)
24+
25+
changelog_text_decoded = changelog_text.decode("utf-8")
26+
if '## [Unreleased]' in changelog_text_decoded:
27+
# Replace the `Unreleased` section with the new version entry
28+
print("Found `## [Unreleased]` section. Updating it.")
29+
changelog_text = re.sub(br'## \[Unreleased\]', bytes(changelog_entry, 'UTF-8'), changelog_text)
30+
else:
31+
# `Unreleased` section does not exist, so prepend the new entry at the top
32+
print("No `## [Unreleased]` section found. Prepending the new entry.")
33+
changelog_text = bytes(f"{changelog_entry}\n\n", 'UTF-8') + changelog_text
2334

2435
with open(changelog_path, 'wb') as f:
2536
f.write(changelog_text)
@@ -59,6 +70,7 @@ def get_manifest_json_version(filename):
5970
return data['version']
6071

6172
if __name__ == '__main__':
73+
print(f"Current working directory: {os.getcwd()}")
6274
manifest_path = f'{package_name}/package.json'
6375
version = get_manifest_json_version(manifest_path)
6476
update_validation_exceptions(version)

0 commit comments

Comments
 (0)