diff --git a/.github/update-release-branch.py b/.github/update-release-branch.py index c41d3f8b3..4af33e916 100644 --- a/.github/update-release-branch.py +++ b/.github/update-release-branch.py @@ -239,20 +239,27 @@ def main(): run_git('checkout', '-b', new_branch_name, ORIGIN + '/' + args.source_branch) if args.perform_v2_to_v1_backport: + # Migrate the package version number from a v2 version number to a v1 version number print(f'Setting version number to {version}') - subprocess.run(['npm', 'version', version]) - run_git('add', 'package.json', 'package-lock.json', 'runner/package.json', 'runner/package-lock.json') + subprocess.run(['npm', 'version', version, '--no-git-tag-version']) + run_git('reset', 'HEAD~1') + run_git('add', 'package.json', 'package-lock.json') + # Migrate the changelog notes from v2 version numbers to v1 version numbers print('Migrating changelog notes from v2 to v1') subprocess.run(['sed', '-i', 's/## 2./## 1./g', 'CHANGELOG.md']) + + # Amend the commit generated by `npm version` to update the CHANGELOG + run_git('add', 'CHANGELOG.md') + run_git('commit', '--amend', '-m', f'Update version and changelog for v{version}') else: # We don't need to do this for a v1 release, since the changelog has already been updated in the v2 branch. print('Updating changelog') update_changelog(version) - # Create a commit that updates the CHANGELOG - run_git('add', 'CHANGELOG.md') - run_git('commit', '-m', version) + # Create a commit that updates the CHANGELOG + run_git('add', 'CHANGELOG.md') + run_git('commit', '-m', f'Update changelog for v{version}') run_git('push', ORIGIN, new_branch_name)