language: node_js
cache: npm

# Trigger a push build on master and greenkeeper branches + PRs build on every branches
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
branches:
  only:
    - master
    - /^greenkeeper.*$/

stages:
  - test
  - name: release
    if: branch = master AND type IN (push)

jobs:
  include:
    - stage: test
      node_js: lts/*
      script: npm test

    - stage: release
      node_js: lts/*
      script: npx semantic-release
