When deploying read stage from environment

This commit is contained in:
Mathieu Magnin 2018-10-19 11:09:57 +02:00 committed by simon lehericey
parent e41a597386
commit 8316ab8e51
2 changed files with 12 additions and 12 deletions

View file

@ -23,10 +23,9 @@ set :repository, 'https://github.com/betagouv/tps.git'
deploy_to = '/var/www/ds' deploy_to = '/var/www/ds'
set :deploy_to, deploy_to set :deploy_to, deploy_to
set :user, 'ds' set :user, 'ds'
branch = 'puma' set :branch, ENV['branch']
set :branch, branch
print "Deploy to #{ENV['domain']}, branch : #{branch}\n" print "Deploy to #{ENV['domain']}, branch : #{ENV['branch']}\n"
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. # Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step. # They will be linked in the 'deploy:link_shared_paths' step.
@ -103,6 +102,7 @@ task :deploy do
# Put things that will set up an empty directory into a fully set-up # Put things that will set up an empty directory into a fully set-up
# instance of your project. # instance of your project.
invoke :'git:clone' invoke :'git:clone'
invoke :'deploy:link_shared_paths' invoke :'deploy:link_shared_paths'
invoke :'bundle:install' invoke :'bundle:install'
invoke :'yarn:install' invoke :'yarn:install'

View file

@ -1,7 +1,14 @@
task :deploy do task :deploy do
if ENV['STAGE_NAME'] == 'dev'
domains = ['web1.dev', 'web2.dev']
elsif ENV['STAGE_NAME'] == 'master'
domains = ['web1', 'web2'] domains = ['web1', 'web2']
end
branch = ENV['STAGE_NAME']
domains.each do |domain| domains.each do |domain|
sh "mina deploy domain=#{domain} force_asset_precompile=true" sh "mina deploy domain=#{domain} branch=#{branch} force_asset_precompile=true"
end end
end end
@ -12,13 +19,6 @@ task :setup do
end end
end end
task :deploy_dev do
domains = ['web1.dev', 'web2.dev']
domains.each do |domain|
sh "mina deploy domain=#{domain} force_asset_precompile=true"
end
end
task :setup_dev do task :setup_dev do
domains = ['web1.dev', 'web2.dev'] domains = ['web1.dev', 'web2.dev']
domains.each do |domain| domains.each do |domain|