language: node_js
node_js:
  - '10'
dist: dist
sudo: required
script:
  - npm ci
  - npm run test
  - npm run build
cache:
  pip: true
  directories:
    - node_modules
before_deploy:
  - if [[ "$TRAVIS_PULL_REQUEST" = false && $TRAVIS_BRANCH == "master" ]]; then
      echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc;
    fi
deploy:
  provider: script
  script: bash scripts/publish.sh
  skip_cleanup: true
  target-branch: $TRAVIS_BRANCH
  on:
    branches:
      only:
        - master
# 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/.*$/
