Skip to content

Instantly share code, notes, and snippets.

@beingadityak
Last active December 6, 2020 14:22
Show Gist options
  • Save beingadityak/57eda9d52012e019594a3bfedfbf0b71 to your computer and use it in GitHub Desktop.
Save beingadityak/57eda9d52012e019594a3bfedfbf0b71 to your computer and use it in GitHub Desktop.
Travis CI - Sample web application deployment on commit
language: node_js
node_js:
- lts/*
# Add the lines from here apart from the auto-generated stuff
before_install:
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/deploy_rsa
- ssh-add /tmp/deploy_rsa
before_deploy:
- rm -rf *.enc .env.enc
# Change the username as per your requirements
deploy:
- provider: script
skip_cleanup: true
script: rsync -e "ssh -o StrictHostKeyChecking=no" -r --quiet . ubuntu@$SERVER_IP:/home/ubuntu/webapp
on:
branch: master
- provider: script
skip_cleanup: true
script: ssh -o StrictHostKeyChecking=no ubuntu@$SERVER_IP 'bash ./scripts/restart.sh'
on:
branch: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment