CLOUD
Guides

GitHub Actions: Auto-Deploy Your App to Your Server

CLOUD|April 11, 2026|2 min read|277 views
GitHub Actions: Auto-Deploy Your App to Your Server

Git push → tests → deploy. Automate your app deployment with GitHub Actions. We explain setup with SSH deploy.

Automated Deployment with GitHub Actions

GitHub Actions makes every push to main automatically result in an updated application on the server, after passing tests.

Complete Laravel Workflow

name: Laravel Deploy

on:
 push:
 branches: [main]

jobs:
 test:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v4
 - name: Setup PHP
 uses: shivammathur/setup-php@v2
 with:
 php-version: '8.3'
 - name: Install dependencies
 run: composer install --no-dev --optimize-autoloader
 - name: Run tests
 run: php artisan test

 deploy:
 needs: test
 runs-on: ubuntu-latest
 if: github.ref == 'refs/heads/main'
 steps:
 - name: Deploy via SSH
 uses: appleboy/ssh-action@v1.0.0
 with:
 host: ${{ secrets.SERVER_HOST }}
 username: ${{ secrets.SERVER_USER }}
 key: ${{ secrets.SSH_PRIVATE_KEY }}
 script: |
 cd /var/www/myapp
 git pull origin main
 composer install --no-dev --optimize-autoloader
 php artisan migrate --force
 php artisan config:cache
 php artisan queue:restart

Setting Up Secrets

ssh-keygen -t ed25519 -C "github-actions-deploy" -f deploy_key
cat deploy_key.pub >> ~/.ssh/authorized_keys

In GitHub: Settings → Secrets and variables → Actions:

Secret Value
SERVER_HOST Server IP address
SERVER_USER Username
SSH_PRIVATE_KEY Full private key content

Caching to Speed Up Builds

- name: Cache Composer packages
 uses: actions/cache@v3
 with:
 path: vendor
 key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

Caching reduces build time from 3-4 minutes to under one minute.

Conclusion

GitHub Actions eliminates human error in manual deployments. Servers on كلاود (cloud.net.sa) fully support this workflow — SSH is ready, no restrictions on automated deployments.


Get Started

Ready to build your project? Configure your cloud server with the specs your app needs, or view plans and pricing.

Share