Plugin publish workflow: Run `git push` before `npm publish`

This commit is contained in:
Richard Hansen 2021-01-05 16:11:29 -05:00 committed by John McLear
parent 6012a9a480
commit 3373f059e6
1 changed files with 12 additions and 2 deletions

View File

@ -64,10 +64,20 @@ jobs:
- run: git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- run: npm ci
- run: npm version patch
- run: git push --follow-tags
# `npm publish` must come after `git push` otherwise there is a race
# condition: If two PRs are merged back-to-back then master/main will be
# updated with the commits from the second PR before the first PR's
# workflow has a chance to push the commit generated by `npm version
# patch`. This causes the first PR's `git push` step to fail after the
# package has already been published, which in turn will cause all future
# workflow runs to fail because they will all attempt to use the same
# already-used version number. By running `npm publish` after `git push`,
# back-to-back merges will cause the first merge's workflow to fail but
# the second's will succeed.
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- run: git push --follow-tags
##ETHERPAD_NPM_V=1
##ETHERPAD_NPM_V=2
## NPM configuration automatically created using bin/plugins/updateAllPluginsScript.sh