Skip to content

Instantly share code, notes, and snippets.

@mikybars
Created February 22, 2019 08:38
Show Gist options
  • Save mikybars/9ed8e45be1c1f7e56d2e261cee42d960 to your computer and use it in GitHub Desktop.
Save mikybars/9ed8e45be1c1f7e56d2e261cee42d960 to your computer and use it in GitHub Desktop.
addons:
ssh_known_hosts: <deploy-host>
before_deploy:
- openssl aes-256-cbc -K $encrypted_<...>_key -iv $encrypted_<...>_iv -in deploy_rsa.enc -out /tmp/deploy_rsa -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/deploy_rsa
- ssh-add /tmp/deploy_rsa
$ gem install travis
$ cd ~/projects/myproj
$ ssh-keygen -t rsa -b 4096 -C 'build@travis-ci.org' -f deploy_rsa
$ travis login --org
$ travis encrypt-file deploy_rsa --add # --add updates .travis.yml
$ ssh-copy-id -i deploy_rsa.pub <ssh-user>@<deploy-host>
$ rm -f deploy_rsa deploy_rsa.pub
$ git add deploy_rsa.enc .travis.yml
$ git commit -a -m "added deploy key"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment