language: node_js
node_js: 12

matrix:
  include:
    - os: osx
      osx_image: xcode10.2
      env:
        - ELECTRON_CACHE=$HOME/.cache/electron
        - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder

    - os: linux
      dist: trusty

cache:
  directories:
    - node_modules
    - $HOME/.cache/electron
    - $HOME/.cache/electron-builder
    - $HOME/.npm/_prebuilds

notifications:
  email: false

script:
  - node --version
  - npm --version
  - |
    if [ "$TRAVIS_OS_NAME" == "linux" ]; then
      npm install && npm run publish:gh:linux
    else
      npm run publish:gh:mac
    fi

before_cache:
  - rm -rf $HOME/.cache/electron-builder/wine

# only run this script on pull requests and merges into
# the 'master' and 'prod' branches
branches:
  only:
    - master
    - dev
