Start free

Deploy Laravel on every push, without a CI pipeline

Push to main and your Laravel app is live, with no workflow file to keep. How Deploy on push uses a read-only deploy key and a signed webhook on GitHub.

In this post
  1. How do you deploy Laravel on every push without CI?
  2. What happens between the push and the release?
  3. Why does Brewless not need access to your code?
  4. How does the GitHub App place the key and the webhook?
  5. What may a push change?
  6. Deploy on push or your own pipeline?

Most Laravel teams want the same thing from a deploy: merge to main, and a few minutes later it is live. The usual way there is a CI pipeline with a workflow file, a runner, a secret with deploy rights and the upkeep that comes with all three. For a small team that only wants the push to go live, that is a lot to keep.

This post shows how Brewless deploys a Laravel app on every push to GitHub without a pipeline, and why it does so without getting access to your code.

How do you deploy Laravel on every push without CI?

You connect the repository once and tell each environment which branch it follows. GitHub then sends Brewless a signed webhook on every push, and a job in your own Scaleway project fetches the commit and builds it, like any deploy. There is no workflow file in your repository and no token with deploy rights at GitHub.

brewless.yml
environments:
  production:
    branch: main
  test:
    branch: develop

A push to develop deploys test, and a push to main deploys production. The Deploy on push documentation walks through connecting a repository.

What happens between the push and the release?

  1. GitHub sends a webhook for the push, signed with a secret of this connection. A delivery without the right signature is ignored.
  2. A job in your own Scaleway project fetches the commit with a read-only deploy key, and checks that it is the newest commit of the branch. What the webhook says about the commit is not trusted.
  3. The commit becomes a release: built in your project, release commands such as your migrations first, then live. If a step fails, the release that was live keeps serving.

A newer push to the same branch overtakes an older one that is still under way, and a commit that is live already starts nothing. You follow each push on its own page in the console: every step with its duration, the build log as it is written, and what the run cost.

Why does Brewless not need access to your code?

Because the fetching happens in your project, not at Brewless. When you connect a repository, Brewless makes a deploy key pair in memory, writes the private half straight to your own Scaleway Secret Manager and keeps only the public half. The job that fetches a commit reads the key from there.

What Where it is
Your code Fetched and built in your own Scaleway project
Private half of the deploy key Your own Secret Manager
Public half of the deploy key On the repository, read-only, and at Brewless
Webhook secret At Brewless, encrypted, and at GitHub to sign pushes

Of the commit, Brewless reads only brewless.yml, to see what the push asks of the environment.

How does the GitHub App place the key and the webhook?

On the Deploy on push page, Place them on your repository signs you in to the Brewless GitHub App and, if needed, installs it on the repository you choose. Brewless then adds the read-only deploy key and the webhook with a token of that installation for that one repository, and ends the token right away.

The app has two permissions on the repositories you install it on: Administration, to add a deploy key, and Webhooks, to add the webhook. It cannot read your code. If you would rather not install an app, paste the key and the webhook in the repository's settings yourself; the console shows both.

Note

We first placed the key with a plain OAuth sign-in, revoked right after. Revoking it made GitHub delete the deploy key that sign-in had added. A key the GitHub App adds stays.

What may a push change?

A push deploys code, so the brewless.yml in a commit may only change what belongs to a release: the sizes of the web and worker containers, the release commands and plain variables. A new database, a bucket, a domain or a change to the edge needs a brewless deploy by someone who may manage the application.

A push that asks for more is refused before anything is built, and the run says which keys and who can deploy them. That way, write access to a repository does not become the right to change your infrastructure. Secrets never come from a push either: they go to your Secret Manager with brewless env:push.

Deploy on push or your own pipeline?

Deploy on push does not run your tests: every push to the branch goes live. If you want the deploy to wait for green tests, run brewless deploy from GitHub Actions with a pipeline token for that one application.

Deploy on push Your own pipeline
Tests before the deploy No Yes
Token with deploy rights at GitHub No Yes, for one application
What a push may change Sizes, release commands, plain variables All of brewless.yml
What you keep up Nothing A workflow file and a token
Where you follow it The console, with a mail when it fails The run in GitHub Actions

Both build in your own Scaleway project, and both can live side by side: a commit that is already live or on its way is not deployed twice.

Deploy on push works with GitHub. GitLab, Bitbucket and Codeberg are available on request: write to hi@brewless.eu.

Frequently asked questions

How do I deploy a Laravel app on every push to GitHub without CI?

Connect the repository on the Deploy on push page of your application in the Brewless console, place the deploy key and the webhook with the Brewless GitHub App or by hand, and choose which branch each environment follows. From then on a push to that branch deploys the environment.

Can Brewless read my code with Deploy on push?

No. The commit is fetched by a job in your own Scaleway project with a read-only deploy key. The private half of that key is written to your own Secret Manager and Brewless keeps only the public half. The Brewless GitHub App may add deploy keys and webhooks, not read code.

Does Deploy on push run my tests?

No. Every push to the branch goes live, built and released like any deploy, with your migrations running first and the old release staying live if something fails. To run tests first, deploy from GitHub Actions with a pipeline token for one application.

Can a push add a database or a domain?

No. A push may change the sizes of the web and worker containers, the release commands and plain variables. Anything else in brewless.yml needs a brewless deploy by someone who may manage the application, and a push that changes it is refused with a message that says so.

Does Deploy on push work with GitLab or Bitbucket?

Deploy on push works with GitHub. GitLab, Bitbucket and Codeberg are available on request; write to hi@brewless.eu.

All posts Read this post as markdown

Try it on your own app

Brewless deploys your Laravel app to Scaleway and bunny.net, in your own accounts. Start free with one application, production included.