Linux:Travis使用rsync部署

来自WHY42
# cd blog
ssh-keygen -t rsa -b 4096 -C 'blog@riguz.com' -f ./deploy_rsa
travis encrypt-file deploy_rsa --add
ssh-copy-id -i deploy_rsa.pub blog@riguz.com

gem install travis
travis login --com --github-token <token>
travis encrypt-file deploy_rsa --add --com
ssh-copy-id -i deploy_rsa.pub blog@riguz.com




# on target server
sudo adduser rsync-deploy
sudo usermod -aG www-data rsync-deploy
sudo chown -R rsync-deploy /var/www/html
addons:
  ssh_known_hosts: 152.32.186.249
before_install:
- openssl aes-256-cbc -K $encrypted_db2095f63ba3_key -iv $encrypted_db2095f63ba3_iv
  -in deploy_rsa.enc -out deploy_rsa -d
- openssl aes-256-cbc -K $encrypted_db2095f63ba3_key -iv $encrypted_db2095f63ba3_iv
  -in deploy_rsa.enc -out ~/.ssh/id_rsa -d
- chmod 600 ~/.ssh/id_rsa

....
rsync -avz --quiet --delete $TRAVIS_BUILD_DIR/public/ blog@:152.32.186.249/var/www/blog
  on: