The Hook (The "Byte-Sized" Intro)
Push a tag. CI builds. Tests pass. Artifacts deploy. Release notes publish. All automatically. Tags are the green light that tells CI to ship. No clicking "deploy" buttons. No running scripts on your laptop. One git push origin v1.2.0 and the entire pipeline handles the rest.
📖 What is Tagging in CI/CD?
CI/CD systems can listen for tag push events and trigger specialized pipelines — building production artifacts, running release tests, deploying to production, and publishing release packages.
Conceptual Clarity
How tags trigger CI:
| Event | CI Trigger | Pipeline Action |
|---|---|---|
| Push commit to PR | on: pull_request | Run tests, lint |
| Push to main | on: push (main) | Run tests, build |
| Push a tag | on: push (tags: v*) | Build + deploy + release |
GitHub Actions example:
on:
push:
tags:
- 'v*' # Triggers on v1.0.0, v2.1.3, etc.
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- run: npm test
- uses: softprops/action-gh-release@v2
with:
files: dist/**Real-Life Analogy
Tags in CI are like the "Approved" stamp on a factory production order. The stamp itself doesn't build the product, but it signals the assembly line to start producing and shipping.
Visual Architecture
Why It Matters
- Automation: No manual deploy steps — tag push triggers everything.
- Reproducibility: The pipeline builds from the exact tagged commit.
- Security: Reduces human access to production deployment.
- Speed: Releases go out in minutes, not hours of manual work.
Code
# ─── Developer workflow ───
# 1. Merge all PRs to main
# 2. Tag the release
git tag -a v1.2.0 -m "Release: new features"
# 3. Push the tag (triggers CI)
git push origin v1.2.0
# 4. CI handles build, test, deploy, release automatically
# ─── Verify CI was triggered ───
gh run list --limit 5
# Shows the triggered workflow run
# ─── View the release CI created ───
gh release view v1.2.0
# ─── Tag pattern matching in CI ───
# 'v*' → matches v1.0.0, v2.0.0-beta
# 'v[0-9]*' → matches v1.0.0, not v-test
# 'release-*' → matches release-2026.02.13Key Takeaways
- CI/CD pipelines trigger on tag push events — one push deploys everything.
- Use tag patterns (
v*) to match only release tags. - The pipeline builds from the exact tagged commit — fully reproducible.
- Reduces human error by automating build, test, deploy, and release.
Interview Prep
-
Q: How do CI/CD systems use Git tags? A: CI systems listen for tag push events and trigger specialized pipelines. When a tag matching a pattern (like
v*) is pushed, the pipeline builds from that exact commit, runs release tests, deploys to production, and publishes release artifacts. -
Q: Why is tag-triggered deployment more reliable than manual deployment? A: Tag-triggered deployment is reproducible (same tag always builds the same code), auditable (the tag records who and when), and consistent (the same pipeline runs every time). Manual deployments vary between operators and are prone to human error.
-
Q: How do you ensure only release tags trigger production deployments? A: Use specific tag patterns in CI configuration (e.g.,
v[0-9]*instead of*) to avoid triggering on non-release tags. Additionally, use branch protection rules and required approvals before tags can be pushed.