Skip to content
Browse files

Continous deployment

If the tests pass, let's just immediately deploy to Heroku.
  • Loading branch information...
1 parent 8166cfd commit 006e246c86efcd9eb70aea7bfe1100be8c7a1ebb @henrikhodne committed
Showing with 52 additions and 0 deletions.
  1. +7 −0 .travis.yml
  2. +2 −0 README.markdown
  3. +43 −0 script/deploy
View
7 .travis.yml
@@ -0,0 +1,7 @@
+language: ruby
+rvm:
+ - 1.9.3
+ - rbx-19mode
+env:
+ - secure: "GGJCc4M20IcsaWe43rVbPGtMhXmq38Gv6z0ujJrEKUq64BLwEUqQy19tj5p9\nHubKf60r5kV3d6RCtJ5ib7BD259Ej+1B98hLLb4r5lpoFjqkImVU9Q1YvzCp\nIBXIeHZMahhhTfNbBgmD485feBae9IOB82xK0lQdVNo0E1bm8b8="
+after_success: script/deploy
View
2 README.markdown
@@ -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.
View
43 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.
Something went wrong with that request. Please try again.