callum
callum

Reputation: 37709

Prevent Travis deploying multiple times when I'm running my tests on multiple Node versions?

I test on three different Node versions (mainly to alert me to any compatibility issues that might arise if I was forced to switch to another version in production):

sudo: false
language: node_js
node_js:
  - iojs
  - '0.12'
  - '0.10'
deploy:
  skip_cleanup: true
  provider: script
  script: ./deploy.sh
  on:
    branch: master
matrix:
  allow_failures:
    - node_js: iojs

But that means my ./deploy.sh script is run three times, from three different containers! I obviously only want one of the successful builds to be deployed. The other builds are just for catching Node issues.

Is there a way to configure it so it only runs my deploy script after one of the jobs? Maybe another setting under on:?

The docs for script provider don't cover this.

Upvotes: 4

Views: 801

Answers (2)

Nicolás Fantone
Nicolás Fantone

Reputation: 2100

What about setting a node: '0.10' option under on:? Like so:

deploy:
  skip_cleanup: true
  provider: script
  script: ./deploy.sh
  on:
    branch: master
    node: '0.10'

This should run the deploy job only on the node: '0.10' target.

From the Travis Deployment official docs:

jdk, node, perl, php, python, ruby, scala, go: For language runtimes that support multiple versions, you can limit the deployment to happen only on the job that matches the desired version.

Upvotes: 7

inJeans
inJeans

Reputation: 199

You could try using a conditional release.

Upvotes: 0

Related Questions