diff --git a/src/bin/plugins/lib/npmpublish.yml b/src/bin/plugins/lib/npmpublish.yml index 4a930144e..f05a532da 100644 --- a/src/bin/plugins/lib/npmpublish.yml +++ b/src/bin/plugins/lib/npmpublish.yml @@ -56,15 +56,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-node@v1 with: node-version: 12 registry-url: https://registry.npmjs.org/ - - run: git config user.name 'github-actions[bot]' - - 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 + - name: Bump version (patch) + run: | + LATEST_TAG=$(git describe --tags --abbrev=0) || exit 1 + NEW_COMMITS=$(git rev-list --count "${LATEST_TAG}"..) || exit 1 + [ "${NEW_COMMITS}" -gt 0 ] || exit 0 + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + npm ci + npm version patch + 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 @@ -79,5 +86,5 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} -##ETHERPAD_NPM_V=2 -## NPM configuration automatically created using src/bin/plugins/updateAllPluginsScript.sh +# Automatically generated by src/bin/plugins/checkPlugin.js +##ETHERPAD_NPM_V=3