language: csharp
mono: none
dotnet: 2.1.301
matrix:
  include:
  - os: linux # Ubuntu 14.04
    dist: trusty
    sudo: required
  - os: osx # OSX 10.12
    osx_image: xcode9
    before_install:
    - brew update
    - ulimit -n 1024
    - os_platform=darwin

# branches to build 
branches:
  only:
  - master

env:
  global:
  - log_prefix=[$TRAVIS_OS_NAME]
  - arch=x64
  - configuration=Release  
  - os_platform=linux
  - CSC_IDENTITY_AUTO_DISCOVERY=false 

cache:
  directories:
  - ${TRAVIS_BUILD_DIR}/Breeze.UI/node_modules
  - $HOME/.electron
  - $HOME/.nuget/packages
  - /usr/share/dotnet/sdk/ # dotnet path for linux
  - /Users/travis/.dotnet/sdk/ # dotnet path for mac

# Work around NuGet issue #2163
# https://github.com/NuGet/Home/issues/2163
# https://github.com/travis-ci/travis-ci/issues/7728

install:
- nvm install 8.11.2
- npm install -g npm@6.2.0

before_script:
- if [ -z "$TRAVIS_TAG" ] ; then TRAVIS_TAG=cd-unstable; fi
- npm --version
- nvm --version

script:
- chmod +x build.sh
- "./build.sh"

deploy:
  provider: releases
  api_key:
    secure: $secure_github_key # this key is set on the Travis build page 
  file_glob: true
  file: 
    - "$TRAVIS_BUILD_DIR/Breeze.UI/app-builds/*.deb"
    - "$TRAVIS_BUILD_DIR/Breeze.UI/app-builds/*.tar.gz"
    - "$TRAVIS_BUILD_DIR/Breeze.UI/app-builds/*.dmg"
  skip_cleanup: true
  overwrite: true
  prerelease: true
  on:
    branch: master
    tags: true