language: node_js
node_js:
- 8
cache:
  directories:
  - node_modules
  - packages/create-react-app/node_modules
  - packages/react-scripts/node_modules
install:
- npm install
script:
- npm run build

addons:
  ssh_known_hosts: deploy@onarbooks.com

before_deploy:
- openssl aes-256-cbc -K $encrypted_0e0de6dfeb09_key -iv $encrypted_0e0de6dfeb09_iv -in travis/deploy_rsa.enc -out /tmp/deploy_rsa -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/deploy_rsa
- ssh-add /tmp/deploy_rsa


deploy:
  provider: script
  skip_cleanup: true
  script: rsync -r --delete-after --quiet $TRAVIS_BUILD_DIR/build/ deploy@onarbooks.com:~/dist/mafalda-web
  on:
    branch: master
