48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Deploy to Server
|
|
|
|
on:
|
|
push:
|
|
branches: [ develop ]
|
|
workflow_dispatch:
|
|
|
|
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 }}
|
|
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!" |