Update npm.gitlab-ci.yml template to only publish when necessary
Background
Right now, the NPM .gitlab-ci.yml
template (lib/gitlab/ci/templates/npm.gitlab-ci.yml
) runs npm publish
on every run, even if the version in package.json
hasn't changed.
Proposal
Update this template to only run publish
if the version in package.json
has changed.
Advantages
Running publish
against an already-published version throws an error. The current template swallows this error and prints a message about the version already existing. However, this also swallows legitimate errors, and when this occurs, the printed message is misleading. By only running publish
when a publish is actually needed, we can avoid swallowing legitimate errors.
Related MRs: !38984 (merged), !48581 (merged)