Why does Travis CI report a build success even though the npm publish failed?
<p>I noticed on build <a href="https://travis-ci.org/neverendingqs/openssl-self-signed-certificate/builds/187723295" rel="nofollow noreferrer">https://travis-ci.org/neverendingqs/openssl-self-signed-certificate/builds/187723295</a> that I forgot to increase the patch version when tagging the repo. However, the build reported as <code>passing</code> even though the npm publish failed due to the version already existing.</p>

<p>Here's the tail end of the log:</p>

<pre><code>Deploying application
NPM API key format changed recently. If your deployment fails, check your API key in ~/.npmrc.
http://docs.travis-ci.com/user/deployment/npm/
~/.npmrc size: 48
npm ERR! publish Failed PUT 403
npm ERR! Linux 4.8.12-040812-generic
npm ERR! argv "/home/travis/.nvm/v0.10.48/bin/node" "/home/travis/.nvm/v0.10.48/bin/npm" "publish"
npm ERR! node v0.10.48
npm ERR! npm  v2.15.1
npm ERR! code E403
npm ERR! "You cannot publish over the previously published version 1.1.5." : openssl-self-signed-certificate
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     &lt;https://github.com/npm/npm/issues&gt;
npm ERR! Please include the following file with any support request:
npm ERR!     /home/travis/build/neverendingqs/openssl-self-signed-certificate/npm-debug.log
No stash found.
Done. Your build exited with 0.
</code></pre>

<p>In case it's important, I have the <code>test</code> script in <code>packages.json</code> set to <code>exit 0</code>, but that occurs before the publish phase, so that shouldn't be the problem(?).</p>

<p>Why didn't Travis CI report the build a failure when the publish failed?</p>

<p>EDIT:</p>

<p>I used the Travis CI CLI to set up NPM publishing by running <code>travis setup npm</code>, based on <a href="https://docs.travis-ci.com/user/deployment/npm/" rel="nofollow noreferrer">https://docs.travis-ci.com/user/deployment/npm/</a>.</p>

<p>My <code>.travis.yml</code> looks like this:</p>

<pre><code>language: node_js
deploy:
  provider: npm
  email: myemail
  api_key:
    secure: blahblahblah
  on:
    tags: true
    repo: neverendingqs/openssl-self-signed-certificate
</code></pre>