Building a deployment pipeline your team is not afraid of
Ship small, ship often, and be able to undo it.
A working pipeline runs automated tests on every commit, builds one artefact, deploys it to a preview environment per pull request, then to staging and production behind the same automation — with a rollback that takes a single command and under a minute.
Key takeaways
- Build the artefact once and promote it; rebuilding per environment reintroduces the differences you were avoiding.
- Preview environments per pull request change how reviews happen more than any tooling change.
- Optimise for recovery time, not for preventing every bad deploy.
- Keep the pipeline fast. A twenty-minute pipeline gets bypassed.
The measure of a pipeline is not how much it checks. It is whether the team deploys on a Friday afternoon without a meeting.
The stages, in order
- 01On every commit: lint, type check and unit tests. Under five minutes or people start skipping the branch protection.
- 02Build once, producing a single artefact that is promoted through environments unchanged.
- 03Preview environment per pull request, with a URL in the PR so reviewers look at the thing rather than the diff.
- 04Staging deploy on merge, with integration tests against it.
- 05Production deploy, manual or automatic depending on your appetite, with health checks and automatic rollback on failure.
Keep it fast
Pipeline duration is a cultural lever. Under five minutes, developers wait for it. Over fifteen, they context-switch and the feedback loop is broken. Cache dependencies, run tests in parallel, and move the slow end-to-end suite to a nightly run rather than blocking every commit with it.
Secrets and access
- Secrets in the platform's secret store, never in the repository, and rotated on a schedule.
- Deployment credentials scoped to the minimum they need, per environment.
- Production deploys require review; staging does not. Friction should be proportional to consequence.
- Every deploy recorded — who, what commit, when — so an incident timeline reconstructs itself.