Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
Continous deployment
Browse files Browse the repository at this point in the history
If the tests pass, let's just immediately deploy to Heroku.
  • Loading branch information
sarahhodne committed Dec 10, 2012
1 parent 8166cfd commit 006e246
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
@@ -0,0 +1,7 @@
language: ruby
rvm:
- 1.9.3
- rbx-19mode
env:
- secure: "GGJCc4M20IcsaWe43rVbPGtMhXmq38Gv6z0ujJrEKUq64BLwEUqQy19tj5p9\nHubKf60r5kV3d6RCtJ5ib7BD259Ej+1B98hLLb4r5lpoFjqkImVU9Q1YvzCp\nIBXIeHZMahhhTfNbBgmD485feBae9IOB82xK0lQdVNo0E1bm8b8="
after_success: script/deploy
2 changes: 2 additions & 0 deletions README.markdown
Expand Up @@ -25,6 +25,8 @@ is currently deployed.

[/deployed-sha]: http://travis-lite.com/deployed-sha

Travis Lite is set up to deploy as soon as a build passes on master. See `script/deploy` for details.

## Contributions

See the CONTRIBUTING.md file.
Expand Down
43 changes: 43 additions & 0 deletions script/deploy
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
cd "$(dirname "$0")/.."

have() { command -v "$1" >/dev/null 2>&1; }

if [[ "$TRAVIS" == "true" ]]; then
if [[ "$TRAVIS_PULL_REQUEST" == "true" ]]; then
echo "This is a pull request. No deployment will be done."
exit 0
fi
if [[ "$TRAVIS_RUBY_VERSION" != "1.9.3" ]]; then
echo "Testing on something other than 1.9.3. No deployment will be done."
exit 0
fi
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "Testing on a branch other than master. No deployment will be done."
exit 0
fi

wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
fi

if ! have heroku; then
echo "The heroku toolbelt is not installed. Please install it: https://toolbelt.heroku.com."
exit 1
fi

git remote add heroku git@heroku.com:travis-lite-staging.git

echo "Host heroku.com" >> ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
echo " CheckHostIP no" >> ~/.ssh/config
echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config

branch="$(git symbolic-ref HEAD 2>/dev/null)"
branch="${branch#refs/heads/}"

mkdir -p ~/.ssh
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa -C "travis-deployment"

yes | heroku keys:add
yes | git push heroku $branch
yes | heroku keys:remove "travis-deployment"

0 comments on commit 006e246

Please sign in to comment.