Constrained Semantic Versioning v1.0.0-beta.1

Summary

This version is deprecated. v1.0.0-rc removes chi, iota, lambda, mu and omicron PreRelease names and limits the Minor to be between 0 and 49999 (instead of 99999). This enables CSemVer version number to fit in a signed 64 bit integer (instead of requiring an unsigned one).

CSemVer is an operational subset of Semantic Versioning 2.0.0 (http://semver.org) that is defined around one strong idea: CSemVer versions are totally ordered, each version corresponds to a unique 64 bits unsigned integer ranging from 1 (v0.0.0-alpha) to 13000100000000000000 (v99999.99999.9999).

CSemVer-CI is an extension that supports CI builds. Its versions follow SemVer 2.0.0, but are not CSemVer compliant. CSemVer-CI defines 2 kind of CI versions:

ZeroBased
Versions are based on the 0.0.0 very first version and are smaller than it. Any version of this kind has always a lower precedence than any version of actual releases.
LastReleasedBased
Versions are based on a previous release. They are greater than their base version but always lower than any successor of their base.

Rationales & examples

1 - CSemVer defines a totally ordered set of versions. This is used to generate and/or control versions that guaranty a correct application of precedence rules and coherency of the emitted artifacts. Each CSemVer version is associated to a unique integer that fits into Windows binary version number.

CSemVerNuGet V2(1)Ordered VersionDescription
v0.0.0-alpha 0.0.0-a 1 The very first possible version is the 0.0.0 alpha (this is a MainPrerelease). There are 42 possible first versions (it can be 0.0.0, 0.1.0 and 1.0.0 with their 13 prereleases).
v0.0.0-alpha.1 0.0.0-a01 101 These are NumberedPreReleases. There can be 99 NumberedPreReleases for each OfficialRelease.
v0.0.0-alpha.2 0.0.0-a02 201
v0.0.0-alpha.0.1 0.0.0-a00-01 2 Oops! There was a bug in the very first alpha and someone, for any reason, needs a fix. This is a PatchPreRelease.
v1.0.0 1.0.0 130001000130001 The first OfficialRelease is a MajorRelease.
v1.0.1 1.0.1 130001000260002 A fix to the first official version: as a PatchRelease, it should contain only bug fixes, no breaking changes.
v1.1.0 1.1.0 130002300140001 Introduction of new features but no breaking changes: welcome to the MinorRelease (that is an OfficialRelease).
v2.0.0-rc 2.0.0-r 260002000120001 A MainPreRelease that prepares the next MajorRelease.

(1) The NuGet packaging system in its V2 version (2015) do not follow Semantic Versioning (the 'special name' - the prerelease part - is simply ordered lexically in ASCII sort order). Moreover this 'special name' can not exceed 20 characters. The latter is the reason why the NuGet V2 package name presented here uses only the initial of the prerelease name (in order to support CSemVer-CI LastReleasedBased versionnig).

2 - CSemVer makes possible to really control the versions that are published. The valid successors (according to Semantic Versioning rules) of any version can be computed (there can be up to 43 successors to a version) and, respectively, one can decide whether a version is a valid predecessor of any other version.

VersionSuccessors
v1.2.3
42 successors
v1.2.4-alpha, v1.2.4-beta, v1.2.4-chi, v1.2.4-delta, v1.2.4-epsilon, v1.2.4-gamma, v1.2.4-iota, v1.2.4-kappa, v1.2.4-lambda, v1.2.4-mu, v1.2.4-omicron, v1.2.4-prerelease, v1.2.4-rc, v1.2.4, v1.3.0-alpha ⇒(2) v1.3.0-rc, v1.3.0, v2.0.0-alpha ⇒ v2.0.0-rc, v2.0.0
v1.2.3-alpha
43 successors
v1.2.3-alpha.0.1, v1.2.3-alpha.1, v1.2.3-beta ⇒ v1.2.3-rc, v1.2.3, v1.3.0-alpha ⇒ v1.3.0-rc, v1.3.0, v2.0.0-alpha ⇒ v2.0.0-rc, v2.0.0
v1.2.3-delta.5
40 successors
v1.2.3-delta.5.1, v1.2.3-delta.6, v1.2.3-epsilon ⇒ v1.2.3-rc, v1.2.3, v1.3.0-alpha ⇒ v1.3.0-rc, v1.3.0, v2.0.0-alpha ⇒ v2.0.0-rc, v2.0.0
v1.2.3-prerelease.2.3
32 successors
v1.2.3-prerelease.2.4, v1.2.3-prerelease.3, v1.2.3-rc, v1.2.3, v1.3.0-alpha ⇒ v1.3.0-rc, v1.3.0, v2.0.0-alpha ⇒ v2.0.0-rc, v2.0.0
v1.2.3-rc
31 successors
v1.2.3-rc.0.1, v1.2.3-rc.1, v1.2.3, v1.3.0-alpha ⇒ v1.3.0-rc, v1.3.0, v2.0.0-alpha ⇒ v2.0.0-rc, v2.0.0

(2) The ⇒ replaces the list of the prerelease names from alpha, beta, chi, delta, epsilon, gamma, iota, kappa, lambda, mu, omicron, prerelease up to rc.

3 - CI builds correspond to productions that are not actual releases: the version has to be automatically created since no real version exist for them. A CI build is defined by: a CIBuildName that identifies the source, the nature, or any other constant key of the build (this is usually the name of the 'branch' in a SCM) and a BuildIndex that is a number or an identifier that gets bigger for each new build (it is usually a simple integer that is provided by the CI process or a timestamp).

CSemVer-CI enables the support of CI buils into CSemVer versions with the guaranty of a valid precedence order (in order to secure deployments). The two kind of versions offers two different guaranties:

ZeroBased
A ZeroBased version has a lower than precedence than any released package, even the very first possible one (v0.0.0-alpha). Risk that a product issued from the CI pollutes any production is highly improbable. One example is enough to understand it: 0.0.0--ci-develop-15 (where CIBuildName is 'develop' and BuldIndex is 15). The double dash (that is perfectly valid in Semantic Versioning 2.0.0) makes this version lower than any other CSemVer versions.
LastReleasedBased
As its name states, this versioning mode relies on the last release (be it Official or PreRelease). Such semantic versions have higher precedence than their base but lowest precedence than any successor of this base. Risk that a product issued from the CI pollutes any production is highly mitigated.
This implements a "post release" feature (see this issue on github ) in Semantic Versionning 2.0.0 that, apparently, supports only a "pre release" feature: there is no 'magic', only a careful use of the precedence order rules (with the help of the double dash trick).

The table below helps understand how CSemVer-CI LastReleasedBased works.

CSemVer-CI LastReleasedBased samples where CIBuildName is 'develop' and BuldIndex is 15
Base VersionCI Version (PostRelease)Immediate successorDescription
v0.4.1-rc.2.1 0.4.1-rc.2.1.ci-develop.15 v0.4.1-rc.2.2

PatchPreRelease

This is the simplest one: by appending a dotted part, the CI version has a greater precedence than its base.
"Base Version" < "CI Version" < "Immediate successor" is guaranteed here and for the 3 other cases below.
v3.2.1-rc.1 3.2.1-rc.1.0.ci-develop.15 v3.2.1-rc.1.1

NumberedPreRelease

It is the "padding" with the .0 here that does the job.
v3.2.1-beta 3.2.1-beta.0.0.ci-develop.15 v3.2.1-beta.0.1

MainPreRelease

The double 0 padding is required for pre release.
v1.2.3 1.2.4--ci-develop.15 1.2.4-alpha

OfficialRelease
(applies to Major, Minor, or PatchRelease)

This uses the double dash trick of the ZeroBased kind, plus another one: the Patch is incremented by one.

Specifications

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

CSemVer

  1. CSemVer versions follow Semantic Versioning 2.0.0 rules but adds some constraints to them.

  2. Syntax of a CSemVer MUST be:

    [v|V]Major.Minor.Patch[-PreReleaseName[.PreReleaseNumber[.PreReleaseFix]]][+BuildMetaData]

  3. CSemVer versions MAY be prefixed with a 'v' or 'V' (GitHub convention). This is the only extension that is not supported by SemVer.

  4. The Major part MUST be defined between 0 and 99999.

  5. The Minor part MUST be defined between 0 and 99999.

  6. The Patch part MUST be defined between 0 and 9999.

  7. The PrereleaseName MAY be denoted by appending a hyphen and a name that MUST be one of the 13 values of the following list (ordered from 0 to 12): alpha, beta, chi, delta, epsilon, gamma, iota, kappa, lambda, mu, omicron, prerelease, rc.

    The PrereleaseName's intial MAY be used as a short form: a, b, c, d, e, g, i, k, l, m, o, p, r.

    Any other name not listed in this set MUST be either mapped to/considered as "prerelease" OR considered syntactically invalid.

  8. The PrereleaseNumber MAY be denoted by appending a dot and a number that MUST be defined between 0 and 99.

  9. The PrereleaseFix MAY be denoted by appending a dot and a number that MUST be defined between 1 and 99.

  10. The PrereleaseNumber 0 MUST appear only when a PrereleaseFix is specified to denote a fix of a first prerelease (v4.3.2-rc.0.2 is the second fix of v4.3.2-rc).

CSemVer-CI

  1. CSemVer-CI versions follow Semantic Version 2.0.0 rules.

  2. Syntax of a CSemVer-CI ZeroTimed MUST be:

    0.0.0--CIBuildName-BuildIndex[+BuildMetaData]

  3. The CIBuildName MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-] and MUST NOT be empty.

  4. The BuildIndex MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-] and MUST NOT be empty. It can be purely numeric.

  5. BuildIndex MUST increase between builds. It MAY be time based with a fixed format (ie. YYYYMMDD-HHMMSS), be an incremented number provided by the CI process or any other numeric or alphanumeric value as long as it is increasing (either numerically or lexically in ASCII sort order) for each build.

  6. Syntax of a CSemVer-CI LastReleasedBased MUST be:

About

The Constrained Semantic Versioning specification is authored by Invenietis.

If you'd like to leave feedback, please open an issue on GitHub.

License

Creative Commons - CC BY 3.0