How to release a backend before the frontend (and roll both back)

Many products ship as two repositories: an API and a web or mobile client. When a change touches both, the order matters. If the frontend goes live first, it calls an endpoint that does not exist yet. If the backend goes live first and removes something the old frontend still uses, users see errors in between.

Make each side safe on its own

Pick an order

The usual rule: backend first, then frontend, when the frontend needs something new. Frontend first, then backend, when the backend is removing something the frontend no longer uses.

Three ways to time the second release

Decide what happens when something fails

Doing it by hand

It works, and it is exactly the kind of babysitting that gets skipped at 11 p.m.

How Merge Scheduler handles it

On paid plans, Merge Scheduler can chain several pull requests into one release. Each later step starts after the previous deploy succeeds, a set number of minutes after it merges, or timed from past deploy times so both finish at about the same moment. If a deploy fails, steps that have not merged are cancelled and steps already live are rolled back, newest first. An optional switch also rolls the earlier steps back when a later one fails. Until it has deploy history for a repository, the timed option waits for the first deploy to finish.

Related: Releasing outside business hours: a checklist for small teams · How to automatically revert a failed deploy (and when not to)