Skip to content

Commit

Permalink
Merge pull request #1197 from github/henrymercer/fix-release-when-pac…
Browse files Browse the repository at this point in the history
…kage-conflicts

Make "Update release branch" workflow fail if `npm version` fails
  • Loading branch information
henrymercer authored Aug 22, 2022
2 parents 53a7a27 + a074542 commit f0a1a35
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 f0a1a35

Please sign in to comment.