Skip to content

Commit

Permalink
Make "Update release branch" workflow fail if npm version fails
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Aug 19, 2022
1 parent 66bb63a commit c145823
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def open_pr(
body.append('')
body.append('Please review the following:')
if len(conflicted_files) > 0:
body.append('- The package.json file contains the correct version.')
body.append(' - [ ] You have added commits to this branch that resolve the merge conflicts ' +
'in the following files:')
body.extend([f' - [ ] `{file}`' for file in conflicted_files])
Expand Down Expand Up @@ -296,15 +297,15 @@ def main():

# 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, '--no-git-tag-version'])
subprocess.check_output(['npm', 'version', version, '--no-git-tag-version'])
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'])
subprocess.check_output(['sed', '-i', 's/^## 2\./## 1./g', 'CHANGELOG.md'])

# Remove changelog notes from v2 that don't apply to v1
subprocess.run(['sed', '-i', '/^- \[v2+ only\]/d', 'CHANGELOG.md'])
subprocess.check_output(['sed', '-i', '/^- \[v2+ only\]/d', 'CHANGELOG.md'])

# Amend the commit generated by `npm version` to update the CHANGELOG
run_git('add', 'CHANGELOG.md')
Expand Down

0 comments on commit c145823

Please sign in to comment.