Build artifacts and versioning
Build once, give the result a version, and deploy that same artifact to every environment.
Why it matters
If staging and production each build from source, they can end up running different code. Building one versioned artifact and promoting it through environments means what you tested is exactly what users get — and rolling back means redeploying the previous version.
Where it fits
What you will learn
- Explain what a build artifact is for your stack.
- Version releases with semantic versioning.
- Trace a running deployment back to its commit.
Before you start
- Package managers and dependencies✓ Learned
- Automated tests✓ Learned
What an artifact is
The output of the build: a frontend bundle, a .jar, a compiled binary, a Python wheel or a container image. It contains everything needed to run except configuration and secrets.
- Commit
- Build + test once
- Artifact v1.4.2
- Staging
- Production
Semantic versioning
- MAJOR (2.0.0) — an incompatible change.
- MINOR (1.5.0) — a new feature that stays compatible.
- PATCH (1.4.3) — a compatible bug fix.
git tag v1.4.2
git push origin v1.4.2
docker build -t registry.example.com/app:1.4.2 .
docker push registry.example.com/app:1.4.2
Tip: Never overwrite a published version. If 1.4.2 is wrong, release 1.4.3 — otherwise nobody can tell which "1.4.2" a server runs.
Official documentation and references
Guides
- npm — About semantic versioning ↗ Official · npm
- Docker — Building best practices ↗ Official · Docker
Specifications
- Semantic Versioning 2.0.0 ↗ Official · semver.org
Learn next
- CI/CD pipelines ›✓ Learned
Related topics
- CI/CD pipelines✓ Learned
- Containers with Docker✓ Learned
- Package managers and dependencies✓ Learned
Done with this topic?
Reviewed 2026-10-23. Links go to the official documentation unless marked otherwise.