dist: bionic
sudo: required
language: node_js
node_js:
  - "lts/*"
  # - "node" disabled due to flaky test failures

cache:
  directories:
    - ~/.npm

branches:
  only:
    - master

notifications:
  email: false

before_install:
  - source .travis/before_install.sh

script:
  - source .travis/script.sh

before_deploy:
  - rm -rf deploy
  - mkdir -p deploy
  - cp -r doc deploy/solanaWeb3Api-$TRAVIS_BRANCH
  - ls -l lib
  - cp lib/index.iife.js deploy/solanaWeb3.min.js
  - ( cd deploy; tar zcf solanaWeb3Api.tgz solanaWeb3Api-$TRAVIS_BRANCH )

deploy:
  - provider: pages
    skip-cleanup: true
    github-token: $GITHUB_TOKEN
    local-dir: doc
    on:
      branch: master
      node_js: "lts/*"

  - provider: script
    skip_cleanup: true
    script:
      - npx semantic-release
    on:
      branch: master
      node_js: "lts/*"

  - provider: releases
    skip-cleanup: true
    file:
      - deploy/solanaWeb3.min.js
      - deploy/solanaWeb3Api.tgz
    api_key: $GITHUB_TOKEN
    on:
      tags: true
      node_js: "lts/*"
