Skip to content

Commit

Permalink
Added npm install to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
faab007nl committed Nov 9, 2023
1 parent ac5e18d commit 7020108
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSHKEY }}
script: "cd /home/UpdateServer/web/update.techscode.com/public_html/ && deploy.sh"
script: "cd /home/UpdateServer/web/update.techscode.com/public_html/ && sh deploy.sh"
20 changes: 12 additions & 8 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,39 @@ echo "-----------------------------------"

# Enter maintenance mode or return true
# if already is in maintenance mode
echo "1/8 Entering maintenance mode"
echo "1/9 Entering maintenance mode"
(php8.1 artisan down) || true

# Pull the latest version of the app
echo "2/8 Pull the latest version of the app"
echo "2/9 Pull the latest version of the app"
git pull origin production

# Install composer dependencies
echo "3/8 Install composer dependencies"
echo "3/9 Install composer dependencies"
/usr/bin/php8.1 /usr/local/bin/composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader

# Clear the old cache
echo "4/8 Clear the old cache"
echo "4/9 Clear the old cache"
php8.1 artisan clear-compiled

# Recreate cache
echo "5/8 Recreate cache"
echo "5/9 Recreate cache"
php8.1 artisan optimize

# Compile npm assets
echo "6/8 Compile npm assets"
echo "6/9 Install npm dependencies"
npm install --no-progress --prefer-dist

# Compile npm assets
echo "7/9 Compile npm assets"
npm run prod

# Run database migrations
echo "7/8 Run database migrations"
echo "8/9 Run database migrations"
php8.1 artisan migrate --force

# Exit maintenance mode
echo "8/8 Exit maintenance mode"
echo "9/9 Exit maintenance mode"
php8.1 artisan up

echo "Deployment finished!"

0 comments on commit 7020108

Please sign in to comment.