This commit is contained in:
pbao9
2026-03-17 17:27:39 +07:00
parent ba0508ff67
commit 56ea3fd74a
+37 -45
View File
@@ -8,49 +8,41 @@ on:
jobs: jobs:
deploy: deploy:
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' }}
echo "🔄 Pulling latest code..."
# Pull latest code git pull origin develop
echo "🔄 Pulling latest code..."
git pull origin ${{ github.ref_name }} echo "📦 Installing Composer dependencies..."
composer install --no-dev --optimize-autoloader
# Install/Update Composer dependencies
echo "📦 Installing Composer dependencies..." echo "📦 Installing NPM dependencies..."
composer install --no-dev --optimize-autoloader npm ci
# Install/Update NPM dependencies echo "🏗️ Building assets..."
echo "📦 Installing NPM dependencies..." npm run build
npm ci --only=production
echo "⚡ Optimizing Laravel..."
# Build assets php artisan config:cache
echo "🏗️ Building assets..." php artisan route:cache
npm run production php artisan view:cache
php artisan optimize
# Laravel optimizations
echo "⚡ Optimizing Laravel..." echo "🧹 Clearing application cache..."
php artisan config:cache php artisan cache:clear
php artisan route:cache
php artisan view:cache echo "🔐 Setting permissions..."
php artisan optimize chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
# Clear application cache
echo "🧹 Clearing application cache..." echo "✅ Deployment completed successfully!"
php artisan cache:clear
# Set permissions
echo "🔐 Setting permissions..."
chmod -R 755 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
echo "✅ Deployment completed successfully!"