This commit is contained in:
pbao9
2026-03-17 17:27:39 +07:00
parent ba0508ff67
commit 56ea3fd74a
+28 -36
View File
@@ -10,47 +10,39 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Deploy to server - name: Deploy to server
uses: appleboy/ssh-action@v1.0.3 uses: appleboy/ssh-action@v1.0.3
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }} key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.PORT || 22 }} port: ${{ secrets.PORT }}
script: | script: |
# Navigate to project directory cd ${{ secrets.PROJECT_PATH }}
cd ${{ secrets.PROJECT_PATH || '/var/www/portal' }}
# Pull latest code echo "🔄 Pulling latest code..."
echo "🔄 Pulling latest code..." git pull origin develop
git pull origin ${{ github.ref_name }}
# Install/Update Composer dependencies echo "📦 Installing Composer dependencies..."
echo "📦 Installing Composer dependencies..." composer install --no-dev --optimize-autoloader
composer install --no-dev --optimize-autoloader
# Install/Update NPM dependencies echo "📦 Installing NPM dependencies..."
echo "📦 Installing NPM dependencies..." npm ci
npm ci --only=production
# Build assets echo "🏗️ Building assets..."
echo "🏗️ Building assets..." npm run build
npm run production
# Laravel optimizations echo "⚡ Optimizing Laravel..."
echo "⚡ Optimizing Laravel..." php artisan config:cache
php artisan config:cache php artisan route:cache
php artisan route:cache php artisan view:cache
php artisan view:cache php artisan optimize
php artisan optimize
# Clear application cache echo "🧹 Clearing application cache..."
echo "🧹 Clearing application cache..." php artisan cache:clear
php artisan cache:clear
# Set permissions echo "🔐 Setting permissions..."
echo "🔐 Setting permissions..." chmod -R 775 storage bootstrap/cache
chmod -R 755 storage bootstrap/cache chown -R www-data:www-data storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
echo "✅ Deployment completed successfully!" echo "✅ Deployment completed successfully!"