Versioning and release¶
This page sets the rules for versioning and releasing ConnectSoft NuGet packages: libraries, API clients and templates. It is written for engineers who change a package and for reviewers who check the version.
How a version is made¶
ConnectSoft package pipelines (156 of the 158 that pack a package) build the version from the build number:
name: $(majorMinorVersion).$(semanticVersion)
variables:
majorMinorVersion: 1.0
semanticVersion: $[counter(variables['majorMinorVersion'], 0)]
majorMinorVersionis set by hand inazure-pipelines.yml.semanticVersionis a pipeline counter. It goes up by one on every run and restarts at 0 whenmajorMinorVersionchanges.dotnet packusesversioningScheme: byBuildNumber, so the package version is the build number, for example1.0.57.- Pack and push run only on builds of the default branch.
Every merge to the default branch therefore publishes a new patch version. There is no separate release step, no Git tag and no required change-log file. The history of the default branch and the pull request descriptions are the release record.
Rules¶
CS-PRC-004: Change the major version for a breaking change and the minor version for a feature¶
Severity: major · Applies to: library, api-client, template · Enforced by: manual · Status: active
Why¶
Consumers choose package versions by number. When every change ships as a patch, a consumer cannot tell a safe update from one that breaks the build or the runtime behaviour. Today 139 of 147 package pipelines are still at 1.0.
Do¶
- Raise the major part of
majorMinorVersion(1.0→2.0) when the change breaks consumers. A breaking change includes: - removing or renaming a public type or member;
- changing a signature;
- changing a default that alters behaviour;
- dropping a target framework;
- changing a contract that callers serialize.
- Raise the minor part (
1.0→1.1) when the change adds public API or behaviour without breaking existing callers. - Leave
majorMinorVersionunchanged for fixes and internal changes. The patch number rises by itself. - For a template, a breaking change is one that changes generated output in a way that existing services cannot take over without manual edits.
Don't¶
- Ship a breaking change as a patch.
- Set the patch number by hand.
Example¶
How to check¶
- When the diff breaks a public API or contract,
majorMinorVersiongets a new major version. - When the diff adds public API, it gets a new minor version.
CS-PRC-005: State breaking changes in the pull request¶
Severity: major · Applies to: library, api-client, template · Enforced by: manual · Status: active
Why¶
The pull request description is the only release note a ConnectSoft package has. Consumers upgrading across a major version look there for what to change.
Do¶
- List each breaking change in the pull request description under "Breaking changes", with what a consumer must change.
- Write "Breaking changes: none" when there are none (see CS-REV-005).
Don't¶
- Hide a breaking change in a pull request described as a refactoring or an upgrade.
How to check¶
A pull request that raises the major version lists its breaking changes and how to migrate.
CS-PRC-006: Publish only from the default branch¶
Severity: major · Applies to: library, api-client, template, pipelines · Enforced by: manual · Status: active
Why¶
A package pushed from a change branch reaches every consumer that floats versions, without review.
Do¶
- Keep the condition
eq(variables['Build.SourceBranch'], 'refs/heads/<default branch>')on the pack and push steps.
Don't¶
- Remove or widen the branch condition on pack and push steps.
- Push packages to the feed by hand from a developer machine.
How to check¶
In azure-pipelines.yml, the pack and push steps run only for the default branch.
Upgrades across the estate¶
Framework and package upgrades that touch many repositories follow ADR-0102 and ADR-0103, and the order in Upgrade order and promotion levels.