AI Hints
Home›CI/CD with GitHub Actions Tutorial›Versions and Releases
CI/CD with GitHub Actions · Lesson 82 of 138

Versions and Git Tags

Naming releases.

⏱ 2 min read▶ Video at 1:35:00🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

Users need simple names for releases, like version one point two point zero. Most projects follow semantic versioning. And in git, you mark a release by putting a tag on a commit.

Versions and Git Tags
From the video: Versions and Git Tags
  • Names for releases
  • Semantic versioning
  • Git tags mark them

Semantic versioning

A version has three numbers. Major, minor, and patch. Bump the patch for bug fixes. Bump the minor for new features, that don't break anything. And bump the major when you make a breaking change, so users know to be careful.

PartBump whenExample
Patchbug fix1.2.0 → 1.2.1
Minornew feature1.2.1 → 1.3.0
Majorbreaking change1.3.0 → 2.0.0

Tagging a commit

Git tag dash A creates an annotated tag, with a message, on the current commit. Git tag lists the tags. After one more commit, git describe says we're one commit past v one point zero point zero, and adds the commit's short SHA.

Terminal
git tag -a v1.0.0 -m "First release"
git tag
v1.0.0
echo "# notes" >> README.md && git commit -qam "Add notes"
git describe --tags
v1.0.0-1-g440a819

Summary

Semantic versions say what changed, and git tags mark the release commits. Push tags with git push dash dash tags. Next, pushing images to a registry.

Key takeaways
  • MAJOR.MINOR.PATCH
  • git tag -a
  • git describe
Next up: Pushing to a Registry — sharing images