Skip to content

Commit

Permalink
Avoid commits with duplicate names during v2 to v1 backport
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Mar 24, 2022
1 parent 124e7d9 commit 5fb01dd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 5fb01dd

Please sign in to comment.