Permalink
Browse files

Run migraions right after deploy to heroku with script/ci_deploy.

Required HEROKU_API_KEY.
  • Loading branch information...
1 parent 60db7ac commit 14fcdff1d81ad936fcc1aabce7cdb4c990207434 @dmitrytrager dmitrytrager committed with timurvafin Oct 30, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −1 Gemfile
  2. +5 −2 script/ci_deploy
View
@@ -31,7 +31,6 @@ gem 'github-markdown' # only for dashboard controller
group :development do
gem 'quiet_assets'
gem 'letter_opener'
- gem 'heroku'
gem 'slim-rails'
gem 'foreman'
gem 'bullet'
@@ -45,6 +44,7 @@ group :development, :test do
gem 'mail_safe'
gem 'rails_best_practices'
gem 'brakeman'
+ gem 'heroku'
end
group :test do
View
@@ -1,20 +1,23 @@
#!/usr/bin/env ruby
# Deploy app to heroku with semaphoreapp
+# http://fs.github.com/dev/ci-semaphoreapp
#
# Usage:
-# script/ci_deploy branch heroku-app-name heroku-colloborator-private-key-encoded-with-base64
+# script/ci_deploy branch heroku-app-name heroku-colloborator-private-key-encoded-with-base64 heroku-colloborator-api-key
# Options:
# * branch - will trigger deploy only for this brunch
# * heroku-app-name - name of your heroku application
# * code will be pushed to git from user with this private key. Key should be encoded with base64: base64 /path/to/private_key
+# * heroku-colloborator-api-key - user's API key requred for run heroku run rake db:migrate
require 'fileutils'
require 'base64'
BRANCH = ARGV.shift
HEROKU_APP = ARGV.shift
KEY_BASE64 = ARGV.shift
+API_KEY = ARGV.shift
CURRENT_BRANCH = ENV['BRANCH_NAME']
def prepare_ssh
@@ -47,7 +50,7 @@ def deploy
end
def run_migrations
- system('bin/heroku run rake db:migrate') || exit(1)
+ system("env HEROKU_API_KEY=#{API_KEY} bundle exec heroku run rake db:migrate") || exit(1)
end
if CURRENT_BRANCH == BRANCH

0 comments on commit 14fcdff

Please sign in to comment.