language: node_js

node_js:
  - "14.15.4"

cache:
  directories:
  - node_modules

before_script:
  - npm run test || travis_terminate 1

script:
  - npm run docs
  - npm run build

deploy:
  - provider: pages
    skip_cleanup: true
    github_token: $github_token
    local_dir: public/documentation
    on:
      branch: master

  - provider: releases
    skip_cleanup: true
    api_key: $github_token
    file: $zip_path
    on:
      tags: true

#after_deploy:
## upload generated zip to chrome web store
## see: https://github.com/MobileFirstLLC/cws-publish
#  - if [ ! -z  "$TRAVIS_TAG" ]; then
#      npx cws-upload $client_id $secret $token $zip_path $extension_id;
#    fi
