.NET CI for Couchbase Lite has finally come to fruition, and now the question is how to go about versioning it. Nuget is lagging behind Semantic Versioning due to changes that were made in SemVer 2.0 that are technically challenging for Nuget. This means that we are left with the following:
- Major.Minor.Patch (and for some reason one more is allowed on Nuget, possibly for compatibility with Microsoft version rules) and optionally, a dash (-) and some very limited prerelease versioning.
- An increment in any of the “dot” numbers results in a “newer” version in Nuget’s eyes.
- Versions with prerelease information sort before their non-release counterparts
- Higher prerelease info means a “newer” version.
But what constitutes “higher” prerelease info? Unfortunately, this was not specified in SemVer 1.0 and so Nuget went with a simple ASCII sort. This means that this will happen:
- 1.0.0-pre1 1.0.0-pre2 1.0.0-pre3 … 1.0.0-pre9
- 1.0.0-pre1 1.0.0-pre10 1.0.0-pre2 … 1.0.0-pre9
A common way to counteract this is with zero padding, but how many zeroes depends on what you are doing. Taking these into account I’d like to introduce Couchbase Lite’s versioning system (subject to change but I don’t think it will):
CI server builds -> (Major).(Minor).(Patch)-build(buildno)
Prerelease builds (WIP, biweekly tested releases) -> (Major).(Minor).(Patch)-pre(releaseno)
Final builds -> (Major).(Minor).(Patch).[GoofCarry] <– Goof carry is reserved for when I drop the ball and have to repackage the same bits (Nuget doesn’t allow do-overs)
This version number will be set by the build server, and be output in the logs as well as embedded into the assembly information (You can view it in the Explorer properties on Windows). Hopefully this will allow me to get better at releasing. With months in between the former releases I would forget everything I learned each time.