@@ -6,8 +6,7 @@ Automated Constrained Semantic Versioning for MSBuild projects
66
77
88## Overview
9- NUGET Packages use a SemVer 2.0 (see http://semver.org )
10-
9+ Officially, NUGET Packages use a SemVer 2.0 (see http://semver.org ).
1110However, SemVer 2.0 doesn't consider or account for publicly available CI builds.
1211SemVer is only concerned with official releases. This makes CI builds producing
1312versioned packages challenging. Fortunately, someone has already defined a solution
@@ -57,6 +56,52 @@ The Major, Minor and Patch versions are only updated in the master branch at the
5756of a release. This ensures the concept that SemVer versions define released products. The
5857version numbers used are stored in the repository in the BuildVersion.xml
5958
59+ ## Properties used to determine the version
60+ CSemVer.Build uses MSBuild properties to determine the final version number.
61+
62+ | Name | Default Value | Description|
63+ | -------------------| --------------------------------------------------------------| ------------|
64+ | BuildMajor | Read from BuildVersion.xml | Major portion of the build number |
65+ | BuildMinor | Read from BuildVersion.xml | Minor portion of the build number |
66+ | BuildPatch | Read from BuildVersion.xml | Patch portion of the build number |
67+ | PreReleaseName | ` <Undefined> ` or value read from BuildVersion.xml if present | PreRelease Name of the CSemVer |
68+ | PreReleaseNumber | ` <Undefined> ` or value read from BuildVersion.xml if present | PreRelease Number of the CSemVer |
69+ | PreReleaseFix | ` <Undefined> ` or value read from BuildVersion.xml if present | PreRelease Fix of the CSemVer |
70+ | BuildMeta | ` <undefined> ` | Build meta for the version
71+ | CiBuildName | ` <see notes> ` | CSemVer CI name
72+ | CiBuildIndex | ISO 8601 formated UTC time-stamp for the build | Provides a unique build to build value guaranteed to increase with each build
73+
74+ ### CiBuildName
75+ Unless explicitly provided, the CiBuildName is determined by a set of properties that indicate the nature of the
76+ build. The properties used (in evaluation order) are:
77+
78+ | Name | Default Value | CiBuildName | Description|
79+ | -------------------| ---------------| ---------------| ------------|
80+ | IsPullRequestBuild | ` <Undefined> ` | ` PRQ ` if true | Used to indicate if the build is from a pull request |
81+ | IsAutomatedBuild | ` <Undefined> ` | ` BLD ` if true | Used to indicate if the build is an automated build |
82+ | IsReleaseBuild | ` <Undefined> ` | ` ZZZ ` if !true | Used to indicate if the build is an official release build |
83+
84+ These three values are determined by the automated build in some form. These are either explicit variables set for
85+ the build definition or determined on the fly based on values set by the build. Commonly a ` directory.build.props `
86+ for a repository will specify these. The following is an example for setting them based on an AppVeyor build in
87+ the ` Directory.Build.props ` file:
88+
89+ ``` xml
90+ <PropertyGroup >
91+ <!-- If running in APPVEYOR it is an automated build -->
92+ <IsAutomatedBuild Condition =" '$(IsAutomatedBuild)'=='' AND '$(APPVEYOR)'!=''" >true</IsAutomatedBuild >
93+ <IsAutomatedBuild Condition =" '$(IsAutomatedBuild)'==''" >false</IsAutomatedBuild >
94+
95+ <!-- If it has a PR number associated it is a PR build -->
96+ <IsPullRequestBuild Condition =" '$(IsPullRequestBuild)'=='' AND '$(APPVEYOR_PULL_REQUEST_NUMBER)'!=''" >true</IsPullRequestBuild >
97+ <IsPullRequestBuild Condition =" '$(IsPullRequestBuild)'==''" >false</IsPullRequestBuild >
98+
99+ <!-- Tags applied to the master branch without a PR are release builds -->
100+ <IsReleaseBuild Condition =" '$(IsReleaseBuild)'=='' AND '$(APPVEYOR_REPO_TAG)'=='true' AND '$(APPVEYOR_PULL_REQUEST_NUMBER)'=='' AND '$(APPVEYOR_BRANCH)'=='master'" >true</IsReleaseBuild >
101+ <IsReleaseBuild Condition =" '$(IsReleaseBuild)'==''" >false</IsReleaseBuild >
102+ </PropertyGroup >
103+ ```
104+
60105## Building the tasks
61- The tasks are pure C# so building the package simply involves simply building the
106+ The tasks are pure C# so building the package simply involves building the
62107src\CSemVer.Build.Tasks.sln
0 commit comments