Created
May 5, 2017 16:52
-
-
Save acbilimoria/52d857f7a13c7e40d00304d6b4ab1083 to your computer and use it in GitHub Desktop.
One Touch Build & Deploy - Laravel 5.4 on LEMP Stack Ubuntu 16.04
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
#!/usr/bin/env ruby | |
# 1. Read STDIN (Format: "from_commit to_commit branch_name") | |
from, to, branch = ARGF.read.split " " | |
# 2. Only deploy if master branch was pushed | |
if (branch =~ /master$/) == nil | |
puts "Received branch #{branch}, not deploying." | |
exit | |
end | |
# 3. Copy files to deploy directory | |
deploy_to_dir = File.expand_path('/var/www/SITE-DIRECTORY') | |
`GIT_WORK_TREE="#{deploy_to_dir}" git checkout -f master` | |
puts "DEPLOY: master(#{to}) copied to '#{deploy_to_dir}'" | |
# 4. Deployment Tasks | |
exec("cd /var/www/SITE-DIRECTORY/ ; ./production-build.sh") |
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
# disable debugging | |
sed -i "s/'debug' => env('APP_DEBUG', true),/'debug' => env('APP_DEBUG', false),/g" config/app.php | |
composer install --no-dev --optimize-autoloader | |
npm run production | |
php artisan optimize | |
php artisan route:cache | |
php artisan cache:clear | |
php artisan migrate | |
phpunit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment