Bird
Raised Fist0
Gitdevops~10 mins

Deployment triggers from tags in Git - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Deployment triggers from tags
Create or push a Git tag
↓
Git detects new tag event
↓
CI/CD system listens for tag events
↓
Trigger deployment pipeline
↓
Deploy application based on tag version
↓
Notify success or failure
This flow shows how pushing a Git tag can trigger a deployment pipeline automatically.
Execution Sample
Git
git tag v1.0.0

git push origin v1.0.0
Create a tag named v1.0.0 locally and push it to the remote repository to trigger deployment.
Process Table
StepActionEvent DetectedPipeline TriggeredDeployment Status
1Create tag v1.0.0 locallyNoNoNo
2Push tag v1.0.0 to originYes (tag push)YesStarted
3CI/CD pipeline runs deploymentN/AN/ASuccess
4Notify deployment resultN/AN/ACompleted
💡 Deployment completes successfully after pipeline triggered by tag push event.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
Tag Exists on LocalNoYes (v1.0.0)Yes (v1.0.0)Yes (v1.0.0)Yes (v1.0.0)
Tag Exists on RemoteNoNoYes (v1.0.0)Yes (v1.0.0)Yes (v1.0.0)
Pipeline TriggeredNoNoYesYesYes
Deployment StatusNot startedNot startedStartedSuccessCompleted
Key Moments - 3 Insights
Why does deployment not start when the tag is created locally?
Deployment triggers only when the tag is pushed to the remote repository, as shown in step 2 of the execution table.
What event causes the CI/CD pipeline to start?
The pipeline starts on detecting a tag push event to the remote repository, as indicated in step 2.
Can deployment happen without pushing the tag to remote?
No, deployment triggers rely on remote events; local tags alone do not trigger pipelines.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the pipeline get triggered?
AStep 2
BStep 1
CStep 3
DStep 4
💡 Hint
Check the 'Pipeline Triggered' column in the execution table.
According to the variable tracker, when does the tag appear on the remote repository?
AAfter Step 3
BAfter Step 1
CAfter Step 2
DAt Start
💡 Hint
Look at the 'Tag Exists on Remote' row in the variable tracker.
If you skip pushing the tag, what happens to the deployment status?
ADeployment starts immediately
BDeployment status remains 'Not started'
CDeployment fails
DDeployment status shows 'Success'
💡 Hint
Refer to the key moment about local tag creation without pushing.
Concept Snapshot
Deployment triggers from tags:
- Create a tag locally with 'git tag <name>'.
- Push the tag to remote with 'git push origin <tag>'.
- CI/CD listens for tag push events.
- On tag push, deployment pipeline runs automatically.
- Deployment status updates after pipeline completes.
Full Transcript
This visual execution shows how deployment triggers from Git tags work. First, a tag is created locally but this alone does not trigger deployment. When the tag is pushed to the remote repository, the CI/CD system detects this event and triggers the deployment pipeline. The pipeline runs and deploys the application version matching the tag. Finally, the deployment status updates to success and notifications are sent. Variables like tag existence on local and remote, pipeline trigger state, and deployment status change step-by-step as shown in the tables. Key moments clarify that only pushing tags triggers deployment, not local creation alone.

Practice

(1/5)
1. What is the main purpose of using tags in Git for deployment triggers?
easy
A. To merge multiple branches into one
B. To delete old branches automatically
C. To create new branches for development
D. To mark specific versions of code for deployment

Solution

  1. Step 1: Understand what tags represent in Git

    Tags are labels that mark specific points in Git history, usually used for releases or versions.
  2. Step 2: Connect tags to deployment triggers

    Deployment systems listen for tag pushes to know when to deploy a specific version of the code.
  3. Final Answer:

    To mark specific versions of code for deployment -> Option D
  4. Quick Check:

    Tags mark versions = C [OK]
Hint: Tags label versions for deployment triggers [OK]
Common Mistakes:
  • Confusing tags with branches
  • Thinking tags delete branches
  • Assuming tags create new branches
2. Which Git command correctly creates a tag named v1.0 and pushes it to the remote repository?
easy
A. git create tag v1.0 && git push tags
B. git push tag v1.0
C. git tag v1.0 && git push origin v1.0
D. git tag create v1.0 && git push origin tags

Solution

  1. Step 1: Identify the correct command to create a tag

    The command git tag v1.0 creates a tag named v1.0 locally.
  2. Step 2: Identify how to push the tag to remote

    git push origin v1.0 pushes the specific tag to the remote repository.
  3. Final Answer:

    git tag v1.0 && git push origin v1.0 -> Option C
  4. Quick Check:

    Create tag + push tag = A [OK]
Hint: Use 'git tag' then 'git push origin tagname' [OK]
Common Mistakes:
  • Using 'git push tag' which is invalid
  • Trying 'git create tag' which is not a Git command
  • Pushing 'tags' instead of specific tag name
3. Given this GitHub Actions snippet, what triggers the deployment workflow?
on:
  push:
    tags:
      - 'release-*'
medium
A. Any push of tags starting with 'release-'
B. Any push to branches named 'release-*'
C. Any push to any branch
D. Any push of tags named exactly 'release-*'

Solution

  1. Step 1: Understand the trigger syntax

    The on.push.tags with pattern 'release-*' listens for tag pushes starting with 'release-'.
  2. Step 2: Differentiate tags from branches

    This does not trigger on branches, only on tags matching the pattern.
  3. Final Answer:

    Any push of tags starting with 'release-' -> Option A
  4. Quick Check:

    Push tags matching pattern = A [OK]
Hint: Tags trigger with 'push.tags' and pattern [OK]
Common Mistakes:
  • Confusing tags with branches in triggers
  • Thinking exact tag name match is required
  • Assuming all pushes trigger workflow
4. You set this in your GitHub Actions workflow:
on:
  push:
    tags:
      - 'v*'

But pushing tag release1 does NOT trigger the workflow. Why?
medium
A. The tag name does not match the pattern 'v*'
B. Tags cannot trigger workflows in GitHub Actions
C. The workflow file is missing from the repository
D. The push event only triggers on branches, not tags

Solution

  1. Step 1: Analyze the tag pattern

    The pattern 'v*' matches tags starting exactly with 'v', like 'v1.0', but 'release1' starts with 'release', so it does not match.
  2. Step 2: Confirm tag triggers work

    GitHub Actions supports tag push triggers, so the problem is pattern mismatch.
  3. Final Answer:

    The tag name does not match the pattern 'v*' -> Option A
  4. Quick Check:

    Pattern mismatch blocks trigger = B [OK]
Hint: Check tag name matches trigger pattern exactly [OK]
Common Mistakes:
  • Assuming any tag triggers workflow
  • Thinking tags can't trigger workflows
  • Ignoring pattern matching rules
5. You want to deploy only when a tag matching deploy-* is pushed. Which GitHub Actions trigger configuration is correct?
hard
A. on: push: tags: - 'release-*'
B. on: push: tags: - 'deploy-*'
C. on: tag_push: pattern: 'deploy-*'
D. on: push: branches: - 'deploy-*'

Solution

  1. Step 1: Identify correct event for tag push

    The push event with tags key listens for tag pushes matching patterns.
  2. Step 2: Match the pattern to desired tags

    The pattern 'deploy-*' matches tags starting with 'deploy-', exactly what is needed.
  3. Step 3: Eliminate incorrect options

    on: push: branches: - 'deploy-*' listens to branches, not tags. on: tag_push: pattern: 'deploy-*' uses invalid syntax. on: push: tags: - 'release-*' matches wrong tag pattern.
  4. Final Answer:

    on: push: tags: - 'deploy-*' -> Option B
  5. Quick Check:

    Push tags with correct pattern = D [OK]
Hint: Use 'push.tags' with correct pattern for deployment triggers [OK]
Common Mistakes:
  • Using branches instead of tags for deployment triggers
  • Using invalid event names like 'tag_push'
  • Mismatching tag patterns
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard