name: Deploy Laravel App # on: # push: # branches: # - main # or 'master' depending on your repo # 👇 Manual trigger only on: workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest steps: # Checkout repository - name: Checkout code uses: actions/checkout@v3 # Setup PHP - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.3' # match your Laravel PHP version extensions: mbstring, bcmath, intl, pdo_mysql coverage: none # Install Composer dependencies - name: Install Composer dependencies run: composer install --no-dev --optimize-autoloader # Install NPM dependencies (if you use Laravel Mix/Vite) - name: Install Node dependencies run: | npm install npm run build # Run Laravel optimizations - name: Laravel Optimizations run: | php artisan config:cache php artisan route:cache php artisan view:cache # Deploy via rsync over SSH # - name: Deploy to Hosting # uses: burnett01/rsync-deployments@5.2 # with: # switches: -avzr --delete # path: ./ # local path (repo root) # remote_path: /home/benicmarscreencr/public_html/jokes-api-2025-s2 # remote path on server # remote_host: ${{ secrets.SSH_HOST }} # remote_user: ${{ secrets.SSH_USER }} # remote_key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Deploy via SSH and SCP uses: appleboy/ssh-action@v1.1.0 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} port: 22 source: "./" # local folder to copy target: "/home/benicmarscreencr/public_html/jokes-api-2025-s2" # remote folder rm: true # remove existing files in target folder before copy script: sh deploy_script.sh