MOON
Server: Apache
System: Linux ip-208-109-13-31.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els4.x86_64 #1 SMP Sat Aug 31 06:58:57 UTC 2024 x86_64
User: durgeshpandey215 (1013)
PHP: 8.1.29
Disabled: NONE
Upload Files
File: /home/durgeshpandey215/public_html/bharatmatabackend.skilladders.com/DB/deploy_old.yml
name: Deploy to Production

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3

      - name: Deploy via SSH
        uses: appleboy/ssh-action@v1.0.0
        with:
          host: 68.178.166.26
          username: farmtoapmc
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          port: 22
          script: |
            echo "🔄 Starting deployment when code pushed to main..."
            cd /home/farmtoapmc/public_html
            git reset --hard HEAD
            git clean -fd
            eval "$(ssh-agent -s)"
            git pull origin main
            /opt/cpanel/ea-php82/root/usr/bin/php artisan optimize:clear
            # /opt/cpanel/ea-php82/root/usr/bin/php artisan config:cache
            # /opt/cpanel/ea-php82/root/usr/bin/php artisan route:cache
            # /opt/cpanel/ea-php82/root/usr/bin/php artisan view:cache
            /opt/cpanel/ea-php82/root/usr/bin/php artisan storage:link
            echo "✅ Deployment complete."
            if [[ -n "$SSH_AGENT_PID" ]]; then
              echo "Killing ssh-agent with PID $SSH_AGENT_PID"
              kill $SSH_AGENT_PID
            fi
            exit 0