GitHub Actions: Automatic Deployment to VPS

Cloud & DevOps · 19.04.2026
GitHub Actions: Automatic Deployment to VPS

GitHub Actions: CI/CD Deploy to VPS

GitHub Actions automatically tests and deploys to VPS on every push to the repository.

PHP Project Workflow

# .github/workflows/deploy.yml
name: Deploy to VPS
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Deploy via SSH
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.VPS_HOST }}
          username: ${{ secrets.VPS_USER }}
          key: ${{ secrets.VPS_SSH_KEY }}
          script: |
            cd /var/www/html && git pull
            composer install --no-dev
            php artisan migrate --force
            php artisan config:cache
Zero-downtime: Deploy to /releases/$(date), switch symlink, reload PHP-FPM.
← Back to Knowledge Base Ask Support