Build Stages: Deploying to npm
This example has 2 build stages:
- Four jobs that run tests against Node versions 4 to 7
- One job that deploys (releases) the package to npm
Here’s what the .travis.yml
config could look like:
language: node_js
node_js:
- "7"
- "6"
- "5"
- "4"
script: echo "Running tests against $(node -v) ..."
jobs:
include:
- stage: npm release
node_js: "7"
script: echo "Deploying to npm ..."
deploy:
provider: npm
api_key: $NPM_API_KEY
on: deploy-npm-release
This is how the build matrix might look:
You can find the code for this example on our demo repository: