sudo: false

cache:
  directories:
    - node_modules

env:
  global:
    - GIT_NAME: "'Couscous auto deploy'"
    - GIT_EMAIL: couscous@couscous.io
    - GH_REF: github.com/swisnl/jQuery-contextMenu
    - SAUCE_USERNAME: "bbrala-contextmenu"
    # GH_TOKEN
    - secure: gWIh9j5sUgVn9DmVDYnmS4OT2GhHmsndLTPKRLgAF8LM4sa65SkSCNB4Xu5drcb1a6e4egOe0bXNgXSl70ApBoQIxPvjvWxLBCjPQBPD6kJjo2ovOsfxLARMSGAqlGN7hiocLi+s8qa7RP3uuJ373z+Ge+bLIV6vFxEjK9U3Iz4=
    # SAUCE_ACCESS_KEY
    - secure: UOse3txRLxLQKsPVQf6OKZZP3c0nLaPJ+4G2vR/qJqBXCTTCQ84+9qx9ih/40FDFcjVXwabJsdn0EhkqDw4h50OGdc58V1UfSbk7g1RiuvvRakOPTK0J9h7bEkBPb7QQXCvAVfOZ81DN6l5lMjmH1tiC2T/h/MNOLHPXsbzXElg=

matrix:
  include:
    - language: node_js
      node_js: "10"
      env: JQUERY=1
    - language: node_js
      node_js: "10"
      env: JQUERY=2
    - language: node_js
      node_js: "10"
      env: JQUERY=3
    - language: php
      php: 7.4
      env: DOCUMENTATION=1
  allow_failures:
    - env: DOCUMENTATION=1


install:
- if [ "$JQUERY" ] ; then yarn add jquery@$JQUERY ; fi
- if [ "$DOCUMENTATION" ] ; then cd documentation && composer global require couscous/couscous ; fi

script:
- if [ "$JQUERY" ] ; then yarn run test ; else /home/travis/.config/composer/vendor/bin/couscous travis-auto-deploy --php-version=7.4 ; fi
- if [ "$JQUERY" ] && [ "$SAUCE_USERNAME" ] ; then yarn run test-sauce ; fi

deploy:
  provider: npm
  email: bjorn@swis.nl
  api_key:
    secure: YvSWphr8aTtwhvzO99jAVl4KoGHFEwwYVf1R7mklO3ZvU4yM1AYQ7m/gwpgkO3vBl0U6C1ixoE5VZzZHHDx3U1UAWeKktVdTvCp3uBDlnRVJdPIQ2gR5hT8X6j6LLTBc1iN/gaf5rT8xTeeeJp/M9gK6f757k88ZLm1DP/mdU3w=
  on:
    tags: true
    repo: swisnl/jQuery-contextMenu
    branch: master
    condition: $JQUERY = 3
