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:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.PORT || 22 }}
script: |
# Navigate to project directory
cd ${{ secrets.PROJECT_PATH || '/var/www/portal' }}
# Pull latest code
echo "🔄 Pulling latest code..."
git pull origin ${{ github.ref_name }}
# Install/Update Composer dependencies
echo "📦 Installing Composer dependencies..."
composer install --no-dev --optimize-autoloader
# Install/Update NPM dependencies
echo "📦 Installing NPM dependencies..."
npm ci --only=production
# Build assets
echo "🏗️ Building assets..."
npm run production
# Laravel optimizations
echo "⚡ Optimizing Laravel..."
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan optimize
# Clear application cache
echo "🧹 Clearing application cache..."
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!"
- name: Deploy to server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.PORT }}
script: |
cd ${{ secrets.PROJECT_PATH }}
echo "🔄 Pulling latest code..."
git pull origin develop
echo "📦 Installing Composer dependencies..."
composer install --no-dev --optimize-autoloader
echo "📦 Installing NPM dependencies..."
npm ci
echo "🏗️ Building assets..."
npm run build
echo "⚡ Optimizing Laravel..."
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan optimize
echo "🧹 Clearing application cache..."
php artisan cache:clear
echo "🔐 Setting permissions..."
chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
echo "✅ Deployment completed successfully!"