Created
March 21, 2017 13:32
-
-
Save fordnox/6a559116d64d901a9d53e7e8ab1b52e2 to your computer and use it in GitHub Desktop.
universal mina deploy script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mina/rsync' | |
set :user, ENV['USER'] || 'username' | |
set :domain, ENV['DOMAIN'] || 'foobar.com' | |
set :deploy_to, ENV['DEPLOY_PATH'] || '/tmp/deploy' | |
set :branch, ENV['GIT_BRANCH'] || 'master' | |
set :repository, ENV['GIT_REPO'] || '.' | |
set :rsync_options, %w[ | |
--recursive --delete --delete-excluded | |
--exclude .git* | |
--exclude /config/deploy.rb | |
--exclude /bower_components | |
--exclude /node_modules | |
--exclude /tests | |
--exclude app.json | |
--exclude bower.json | |
--exclude composer.lock | |
--exclude composer.json | |
--exclude docker-compose.yml | |
--exclude gulpfile.js | |
--exclude heroku.conf.override.php | |
--exclude newrelic.ini | |
--exclude nginx_app.conf | |
--exclude package.json | |
--exclude Procfile | |
--exclude README.md | |
--exclude rev-manifest.json | |
] | |
set :rsync_stage, ENV['RSYNC_STAGE'] || '.' | |
set :forward_agent, true | |
desc 'Deploy to server' | |
task :deploy do | |
deploy do | |
invoke 'rsync:deploy' | |
invoke 'deploy:cleanup' | |
end | |
end | |
desc 'Compile assets for production' | |
task :precompile do | |
Dir.chdir settings.rsync_stage do | |
print_str '-----> NPM Install' | |
system '/usr/bin/npm install --production' or exit!(1) | |
print_str '-----> Composer Install' | |
system '/usr/local/bin/composer install --no-dev --ignore-platform-reqs --no-scripts' or exit!(1) | |
end | |
end | |
task 'rsync:stage' do | |
invoke 'precompile' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment