demarches-normaliennes/lib/tasks/deploy.rake

28 lines
594 B
Ruby
Raw Normal View History

2018-10-24 16:00:07 +02:00
def domains_for_stage(stage)
case stage
2018-10-23 18:26:23 +02:00
when 'dev'
['web1.dev', 'web2.dev']
when 'prod'
2018-10-23 18:26:23 +02:00
['web1', 'web2']
else
2018-10-24 16:00:07 +02:00
raise "STAGE #{stage} is unknown. It must be either dev or prod."
end
end
task :setup do
2018-10-24 16:00:07 +02:00
domains = domains_for_stage(ENV.fetch('STAGE'))
domains.each do |domain|
sh "mina setup domain=#{domain} force_asset_precompile=true"
2018-09-03 18:36:09 +02:00
end
end
task :deploy do
2018-10-24 16:00:07 +02:00
domains = domains_for_stage(ENV.fetch('STAGE'))
branch = ENV.fetch('BRANCH')
2018-09-03 18:36:09 +02:00
domains.each do |domain|
sh "mina deploy domain=#{domain} branch=#{branch} force_asset_precompile=true"
end
end