0PricingLogin
PHP Academy · Lesson

Deploying with GitHub Actions

Automate build, test, and SSH deployment steps in a GitHub Actions workflow.

What is GitHub Actions?

GitHub Actions is a CI/CD platform built into GitHub. Workflows defined in .github/workflows/*.yml automatically run on push, pull request, or schedule events.

Basic Workflow Structure

A workflow consists of one or more jobs, each with steps.

# .github/workflows/deploy.yml
name: Deploy

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up 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: vendor/bin/phpunit

All lessons in this course

  1. Nginx and PHP-FPM Configuration
  2. Environment Variables and .env Files
  3. Deploying with GitHub Actions
  4. Dockerizing a PHP Application
← Back to PHP Academy