7

I am trying to build and deploy my npm package to npm registry automatically upon push to master branch.

Here is my .travis.yml file content:

language: node_js
node_js:
- '0.11'
- '0.10'
deploy:
  provider: npm
  api_key:
    secure: XXX
  on:
    tags: true
    branch: master

The build runs successfully, but the deployment fails with message:

Skipping deployment with the npm provider because this branch is not permitted to deploy.

Why is that? I tried both without specifying any branch and specifying 'master' branch explicitly.

Here is the travis build status in details.

Any suggestion/clue to solve this issue is appreciated. Thanks in advance.

kenorb
  • 118,428
  • 63
  • 588
  • 624
Rana
  • 5,112
  • 10
  • 49
  • 86

1 Answers1

7

With tags: true you specify, that only tagged commits will be deployed. If I'm not mistaken, Travis CI does not explicitly check on which branch such a commit is on. So either specify tags: true, then make a tagged commit OR specify branch: master and commit to this branch to trigger a deployment.

But using both statements won't work.

You can find a note in the Travis CI documentation (similar for GitHub) stating:

tags: When set to true, the application is deployed when a tag is applied to the commit. (Due to a known issue, you should also set all_branches: true.)

So the correct answer is to specify either a branch OR use tags: true and all_branches: true.

If you're using GitHub:

Please note that deploying GitHub Releases works only for tags, not for branches.

kenorb
  • 118,428
  • 63
  • 588
  • 624
Odi
  • 6,866
  • 2
  • 32
  • 51
  • Thanks for the clue. However, I tried with only 'tags:true', without branch definition, but unfortunately, that didn't work either. However, now, I tried with only branch definition without tags definition, which worked! What is the problem with tags then?! – Rana Jan 05 '15 at 15:54
  • 1
    @Rana I just found the answer in the docs, see my update about `all_branches: true` – Odi Jan 05 '15 at 22:46
  • Ah! I missed that somehow. Thanks! – Rana Jan 06 '15 at 01:06