CI/CD for Small Teams: A Laravel and Flutter Pipeline with GitHub Actions

On small teams, deployment often lives in one person's head: "run this command first, then connect to the server, and don't forget to clear the cache." When that person goes on leave or skips a step, a broken release ends up in production. In this post we describe how we set up a lean deployment pipeline for a Laravel backend and a Flutter mobile app with GitHub Actions, without growing the team or committing to expensive tools.

Keep the pipeline's goal small at first

The first goal isn't to automate everything; it's to keep broken code out of the main branch. Two stages are enough for that: tests and static analysis on every pull request, and a deployment when changes are merged into the main branch. Your workflow files live in the .github/workflows/ folder and are separated by the on: pull_request and on: push triggers. If the pipeline starts out simple, the team adopts it; a pipeline built to be complex from day one ends up disabled as "broken."

The Laravel side: test, build, deploy

We use shivammathur/setup-php to set up the PHP environment and actions/checkout to fetch the code. We install dependencies with composer install --no-interaction --prefer-dist and run php artisan test; for the test database, you can choose in-memory SQLite or a MySQL service spun up inside the pipeline. Caching Composer with actions/cache shortens the run time noticeably.

For deployment, the most reliable method is release folders plus a symbolic link. The new release is unpacked into a separate folder, composer install --no-dev --optimize-autoloader runs, and then the php artisan migrate --force and php artisan config:cache steps are applied. Once everything is ready, the current link is switched to the new folder, and php artisan queue:restart makes the queue workers load the new code. If something goes wrong, pointing the link back to the old folder takes seconds.

The new release is unpacked into a separate folder, dependencies are installed, migrate and config:cache run, the current link is switched, and the queue is restarted.
If something goes wrong, pointing the link back to the old folder takes seconds.

The Flutter side: analyze, test, signed build

For Flutter, the SDK is set up with subosito/flutter-action. flutter analyze and flutter test run on every pull request. For releases merged into the main branch, the Android bundle is produced with flutter build appbundle. Instead of putting the signing key in the repository, we convert it to base64, store it as a secret, and decode it back into a file inside the pipeline. On the iOS side, flutter build ipa requires a macOS runner, and certificate management is a topic of its own; for small teams, we recommend getting the Android pipeline settled first and adding iOS later.

Secrets, environments, and approvals

  • Keep the server SSH key, signing key, and API keys in the repository or environment secrets area; don't write them into the workflow file.
  • Tie production deployments to an environment definition, and add a required reviewer if needed.
  • Use a concurrency group so that two deployments never collide.
  • Give the deploy user write access on the server only to the folders it actually needs.
  • Make sure the pipeline stops on a failed step; avoid the habit of appending || true, which swallows errors.

What we've learned in the field

The problem we ran into most often was the pipeline getting slower. The fix is usually caching, removing unnecessary steps, and running tests in parallel. The second problem is production being broken while the pipeline is "green." We catch this with a simple post-deploy health check: after deployment, we send a request to a /health endpoint, and if the expected response doesn't come back, we switch the link back to the previous release. The third is database migrations: rather than leaving a hard-to-reverse migration to the deployment pipeline, it's much safer to make it backward compatible first and apply it in two stages. Finally, document the pipeline: the workflow file is already a document, but adding a short note to the repository about which secret is used for what and how to roll back saves a new developer's first day.

Four problems encountered in the field: a slowing pipeline, a green pipeline with broken production, a hard-to-reverse migration, and an undocumented pipeline.
Each problem has a simple, practical answer.

If you'd like to set up a deployment pipeline for your team, automate your current manual deployment process, or ship your Laravel and Flutter projects to production with confidence, write to us through our contact page. Here's what we've seen in the projects we've run for years: a well-built small pipeline genuinely takes away the team's fear of releasing on a Friday evening.