Deploy Laravel for GitHub Actions
View on GitHub

Step 1: Add the deployment script to your project

Download and extract the deployment script. Add the .github/ directory to the root of your project.

This is how the deployment script is structured:

  • .github/workflows/ci-cd.yml
    • This file contains the GitHub Actions workflow. It tells GitHub what kind of runner we want and what it should do.
  • .github/deployment/prepare.sh
    • This bash script prepares the runner to run the deployment. This script is executed inside the GitHub Actions runner.
  • .github/deployment/deploy.sh
    • This bash script is executed on the remote server. It performs the actual deployment.
  • .github/deployment/hooks/
    • This directory contains hooks to customize your deployment. These hooks perform actions such as caching the config, flushing opcache, and restarting the queue.