Skip to content

Instantly share code, notes, and snippets.

@constgen
Last active October 15, 2019 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save constgen/b184818e4b7af2c7eb84add9dc59065b to your computer and use it in GitHub Desktop.
Save constgen/b184818e4b7af2c7eb84add9dc59065b to your computer and use it in GitHub Desktop.
Travis deploy with SSH
language: node_js
node_js:
- "10.15"
install:
- npm install
cache:
directories:
- node_modules
script:
- npm test
- npm run build
#after_success:
# - echo $(<$TRAVIS_BUILD_DIR/build/VERSION)
# - echo $(<$TRAVIS_BUILD_DIR/build/BRANCH)
notifications:
email:
on_pull_requests: false
on_success: change
on_failure: change
# slack:
# on_success: change
# on_failure: change
# on_pull_requests: false
# rooms:
# - secure: XXXXXXXXXXXX
branches:
only:
- master
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
addons:
ssh_known_hosts:
- 8.888.88.88
- 8.888.88.89
before_deploy:
- openssl aes-256-cbc -K $encrypted_13a92b926e32_key -iv $encrypted_13a92b926e32_iv -in deploy_rsa.enc -out deploy_rsa -d
- eval "$(ssh-agent -s)"
- chmod 600 deploy_rsa
- ssh-add deploy_rsa
deploy:
# Deploy to Testing environment
- deploy:
provider: script
skip_cleanup: true
script: rsync -vrh --delete-after $TRAVIS_BUILD_DIR/build/* $USER_NAME@8.888.88.88:/var/www/sensor-ui
on:
branch: master
# Deploy to Staging environment (release)
- deploy:
provider: script
skip_cleanup: true
script: rsync -rh --delete-after --quiet $TRAVIS_BUILD_DIR/build/* $USER_NAME@8.888.88.89:/var/www/sensor-ui
on:
tags: true
branch: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment