Created
January 8, 2023 16:21
-
-
Save anlisha-maharjan/bd244b5f20920702ed0c0ee105058347 to your computer and use it in GitHub Desktop.
Laravel Deployment Script - To pull latest version of code and install composer dependencies and run migrations.
This file contains 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
#!/bin/bash | |
set -e | |
echo "Deployment started ..." | |
# Enter maintenance mode or return true | |
# if already is in maintenance mode | |
(php artisan down) || true | |
# Pull the latest version of the app | |
git pull origin master | |
# Install composer dependencies | |
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader | |
# Clear the old cache | |
php artisan clear-compiled | |
# Recreate cache | |
php artisan optimize | |
# Run database migrations | |
php artisan migrate --force | |
# Exit maintenance mode | |
php artisan up | |
echo "Deployment finished!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment