Search code examples
semantic-versioning

Purpose build metadata in SemVer?


In Semantic Versioning

https://semver.org/#spec-item-10

Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3—-117B344092BD.

  1. What is the purpose of including build meta?
  2. What is the difference between the commit 1.2.3+abc and 1.2.3+bcd?
  3. In what kind of scenario including build meta data will help?

Solution

  • This is mostly for information purposes. You can encode full commit id in the build metadata, so it's faster to analyze from what commit this software was actually build on, or you can encode the date/time of the particular build, machine it was build on.

    The version usually only increments when you do a proper release. While developing the application, the version remains unchanged. But the commit id will change with every snapshot that is released to the development environment.