liveBook · Manning

Semantic versioning

As explained in GitHub Actions in Action: Continuous integration and delivery for DevOps

Semantic versioning is a versioning scheme that communicates compatibility and change significance through major, minor, and patch version numbers.

Semantic versioning communicates whether a released package, library, image, artifact, or GitHub Action is backward compatible. Its MAJOR.MINOR.PATCH number gives consumers a practical signal about the significance of a change before they adopt it. section 8.5.3

Increment the version component that matches the release change:

For a published action, create a semantic-version tag for every release and pair it with a GitHub release when publishing to the marketplace. Keep a moving tag for the current major version: alongside v3.0.0, publish v3; when v3.0.1 fixes an important bug or security issue, move v3 to that fixed commit. Test the action before release. section 4.2.4 section 4.6

This tag strategy lets action users reference a major line while receiving compatible fixes. It should accompany focused action design, test workflows, documentation, and clear action.yml metadata rather than substitute for them. section 4.6

Semantic versions can be calculated from Git history during CI. GitVersion requires an unshallow checkout, then exposes the final version as GITVERSION_SEMVER and exposes major, minor, and patch details as step outputs. Use the calculated version when publishing a package. section 8.5.3

Listing 8.8 Using the GitVersion action
steps: 
- uses: actions/checkout@v3
  with: fetch-depth: 0
 
 - name: Install GitVersion
   uses: gittools/actions/gitversion/setup@v0.9.7
   with: 
     versionSpec: '5.x'
  
 - name: Determine Version
   id: gitversion
   uses: gittools/actions/gitversion/execute@v0.9.7

Use GitVersion after checking out complete history so the workflow can derive a semantic version from the commit being built. section 8.5.3

Publishing a patched major line

A v3.0.0 action release includes both v3.0.0 and v3 tags. After a backward-compatible fix, release v3.0.1 and move v3 to it, preserving a current major-version reference for consumers. section 4.2.4 section 4.6

How GitHub Actions in Action: Continuous integration and delivery for DevOps covers it

How deep it goes
Defines MAJOR.MINOR.PATCH increments and demonstrates Git-history-based calculation, while deferring fuller release-management coverage.
Examples
Uses v3.0.0, v3, and v3.0.1 tags plus a GitVersion workflow with fetch-depth 0.
What it assumes
Assumes GitHub Actions release workflows and teaches the version-number meanings from zero.
What you can do after
Apply it via GitVersion or release tags to publish compatibility-signaling versions and update major tags for fixes.
How it connects
Connects release management with GitHub releases, tags, CI testing, GitVersion, and calendar versioning.

Also explained in

Compare how 8 books explain semantic versioning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of GitHub Actions in Action: Continuous integration and delivery for DevOps. The section links point to the parts of the book it draws on.