Travis-CI can auto “npm publish” your git repo to npmjs, this means that whenever you commit to your github repository your software is always updated and available to users via npm update. This should also work with pull requests so no need to jump onto CLI After a merge, just hit merge and after a few minutes / hours you should see your application updated on npmjs.
Create Travis-CI account, ideally signing in with your github account.
Find the repository you want to auto publish on the Travis Web interface (under your profile) and click Enable.
Install Ruby Gems
sudo apt-get install rubygems
Install travis CLI gem and json gem
sudo gem install json
gem install travis
Create a .travis.yml file in the root of your repository that looks like this (replacing your email)
language: node_js deploy: api_key: email: firstname.lastname@example.org provider: npm
Get your npmjs api key and copy it into the clip board (Copy the bit after the _auth =)
cat ~/.npmrc | grep _auth
Run the Travis CI secret key generator
travis encrypt --add deploy.api_key
When prompted paste your APIKey then hit Control D, don’t add an additional line break or enter.
Add, Commit and Push the new .travis.yml file, this will trigger a build on Travis
git add .travis.yml && git commit -m "Travis auto publish config" && git push
Head over to your Travis page and wait for your build to begin, if it doesn’t it’s likely you didn’t push correctly up to github.
Doing lots of packages?
You will only need to complete steps 5 to 9 on future packages (assuming you enabled them on travis)