Interview Prep/GitHub Actions/Speed, Caching & Cost

A workflow rebuilds the same image in staging and prod deploys. What is wrong and how do you fix it?

IntermediateScenarioSpeed, Caching & Cost
Answer

Situation read → Rebuilding per environment wastes minutes and breaks the guarantee that tested equals shipped.

What I'd do →

  1. Build once in a build job, output the digest.
  2. Deploy jobs (or reusable workflow calls) use image@digest from needs.build.outputs.digest.
  3. Promotion to prod via release tag adds a tag to the existing manifest, no rebuild.

Why → Rebuilds can pull different base images or dependencies, so prod runs something nobody tested.

Interview tip → "Build once, deploy many, by digest."

All GitHub Actions questions Roadmap: GitHub Actions

More on Speed, Caching & Cost