language: node_js
cache:
  yarn: true
  directories:
    - node_modules
node_js:
  - '10'
services:
  - docker
if: tag IS blank
before_install:
  - curl -o- -L https://yarnpkg.com/install.sh | bash
  - export PATH="$HOME/.yarn/bin:$PATH"
stages:
  - name: checks and publish
jobs:
  include:
    - stage: checks and publish
      name: Build, Lint, Test and Possibly Publish
      script:
        - time yarn run check
        - time yarn test
      deploy:
        provider: script
        script:
          - yarn release
        skip_cleanup: true
        on:
          all_branches: true
          condition: $TRAVIS_BRANCH =~ ^(master|alpha|beta|release|[0-9]+\.x$|[0-9]+\.x\.x$|[0-9]+\.[0-9]+\.x)$
    - stage: checks and publish
      name: Build Container and Test Publish
      script:
        - time yarn ci-build-docker
        - yarn release --dry-run
      if: type = pull_request
