Dependency, build, and Docker layer caching in one annotated workflow file. The best deploys are the ones nobody notices. Everything in this post exists to make releases small, reversible, and dull enough that we can ship on a Friday afternoon.
Keep production boring
Our pipeline runs the same steps locally and in CI: install, lint, test, build, and publish an image tagged with the commit hash. If a step cannot run on a laptop, it does not belong in the pipeline.
name: ci
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm test -- --reporter=dot
- uses: docker/build-push-action@v6
with:
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
The pipeline, step by step
We watch four signals for every service: request rate, error rate, latency at the 95th percentile, and saturation. Anything else goes on a secondary dashboard that we look at when those four disagree.
- Tag images with the commit hash.
- Make every deploy reversible in one command.
- Alert on symptoms, not causes.
- Review infrastructure plans like code.
What we monitor
Infrastructure changes go through the same review as application code. Terraform plans are posted to the pull request so reviewers can see exactly what will change before anything is applied.
Before you ship this
Caches are keyed by branch in GitHub Actions. Pull requests can read the default branch cache but not each other’s, so warm the cache on main first.
The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.
Tim Berners-Lee, W3C Web Accessibility Initiative launch, 1997
Wrapping up
If you try this on your own project, start with one page or one service rather than the whole codebase. A small experiment gives you real numbers to argue with, and it is easy to roll back if the idea does not fit.
Comments 0