@@ -19,51 +19,54 @@ GitVersion has three distinct steps for calculating versions in v3.
19191 . If the current commit is tagged, the tag is used and build metadata
2020 (excluding commit count) is added. The other two steps will not execute.
21212 . A set of strategies are evaluated to decide on the base version and some
22- metadata about that version. These strategies include HighestReachableTag,
23- NextVersionInConfig, MergedBranchWithVersion, VersionInBranchName etc.
22+ metadata about that version. See [ Version Strategies] ( #version-strategies )
24233 . The highest base version is selected, using that base version as the new
2524 version is calculated.
2625
2726Visually it looks something like this:
2827
29- ![ Version Calculation] ( https://www.plantuml.com/plantuml/png/fLCxJyCm4DxzAsuib4P914i69De1CS38Vd6kYIN7ZcodK8aVp-KX6Y2fKCbY9NV-7lVb2WoOeoVOMRDNfH0lz1vUoNbbpGwrR3K6ws1p3rlk-bN8u972f2AC3GHEbLN8m1D1Jjg-mPuXAZvx9kL1ZW1KY5dOZczMI0Pf54VnHtf7jpaAWJg0sW-uXw4PK3Eb1sMaevfCW6i1 \_ 0m6po1l7HfPJUxvu5XYUOHLWq5MLptCudmMK9--u5glJ0dIEaVo1Dw3JgVM6Km4cM9mzyrQXHuQHnj7chhl0JcnIrHjno1wiWtgfi8eWVK \_ 7OQAmBHrJWvORFVM2PmrE7AcWZGh-Lj0FvptVvLiUPnCdG_XhNhOov9wQ1fzv7nw5S5EwSvw6CDQNfnMwUAP0XQyQpj70nkx3Nn3p5NFY9IshbNWepKi8ublWFiSPkC0ee8El75Dv5aOxqZQBScbWpWn0Pe2wb6aM1p4Eea \_ 0G00 )
28+ ![ Version Calculation] ( https://www.plantuml.com/plantuml/png/fLCxJyCm4DxzAsuib4P914i69De1CS38Vd6kYIN7ZcodK8aVp-KX6Y2fKCbY9NV-7lVb2WoOeoVOMRDNfH0lz1vUoNbbpGwrR3K6ws1p3rlk-bN8u972f2AC3GHEbLN8m1D1Jjg-mPuXAZvx9kL1ZW1KY5dOZczMI0Pf54VnHtf7jpaAWJg0sW-uXw4PK3Eb1sMaevfCW6i1_0m6po1l7HfPJUxvu5XYUOHLWq5MLptCudmMK9--u5glJ0dIEaVo1Dw3JgVM6Km4cM9mzyrQXHuQHnj7chhl0JcnIrHjno1wiWtgfi8eWVK_7OQAmBHrJWvORFVM2PmrE7AcWZGh-Lj0FvptVvLiUPnCdG_XhNhOov9wQ1fzv7nw5S5EwSvw6CDQNfnMwUAP0XQyQpj70nkx3Nn3p5NFY9IshbNWepKi8ublWFiSPkC0ee8El75Dv5aOxqZQBScbWpWn0Pe2wb6aM1p4Eea_0G00 )
3029
31- [ Edit Diagram] ( https://www.plantuml.com/plantuml/form?url=https://www.plantuml.com/plantuml/png/ fLCxJyCm4DxzAsuib4P914i69De1CS38Vd6kYIN7ZcodK8aVp-KX6Y2fKCbY9NV-7lVb2WoOeoVOMRDNfH0lz1vUoNbbpGwrR3K6ws1p3rlk-bN8u972f2AC3GHEbLN8m1D1Jjg-mPuXAZvx9kL1ZW1KY5dOZczMI0Pf54VnHtf7jpaAWJg0sW-uXw4PK3Eb1sMaevfCW6i1 \_ 0m6po1l7HfPJUxvu5XYUOHLWq5MLptCudmMK9--u5glJ0dIEaVo1Dw3JgVM6Km4cM9mzyrQXHuQHnj7chhl0JcnIrHjno1wiWtgfi8eWVK \_ 7OQAmBHrJWvORFVM2PmrE7AcWZGh-Lj0FvptVvLiUPnCdG_XhNhOov9wQ1fzv7nw5S5EwSvw6CDQNfnMwUAP0XQyQpj70nkx3Nn3p5NFY9IshbNWepKi8ublWFiSPkC0ee8El75Dv5aOxqZQBScbWpWn0Pe2wb6aM1p4Eea \_ 0G00 )
30+ [ Edit Diagram] ( https://www.plantuml.com/plantuml/uml/ fLCxJyCm4DxzAsuib4P914i69De1CS38Vd6kYIN7ZcodK8aVp-KX6Y2fKCbY9NV-7lVb2WoOeoVOMRDNfH0lz1vUoNbbpGwrR3K6ws1p3rlk-bN8u972f2AC3GHEbLN8m1D1Jjg-mPuXAZvx9kL1ZW1KY5dOZczMI0Pf54VnHtf7jpaAWJg0sW-uXw4PK3Eb1sMaevfCW6i1_0m6po1l7HfPJUxvu5XYUOHLWq5MLptCudmMK9--u5glJ0dIEaVo1Dw3JgVM6Km4cM9mzyrQXHuQHnj7chhl0JcnIrHjno1wiWtgfi8eWVK_7OQAmBHrJWvORFVM2PmrE7AcWZGh-Lj0FvptVvLiUPnCdG_XhNhOov9wQ1fzv7nw5S5EwSvw6CDQNfnMwUAP0XQyQpj70nkx3Nn3p5NFY9IshbNWepKi8ublWFiSPkC0ee8El75Dv5aOxqZQBScbWpWn0Pe2wb6aM1p4Eea_0G00 )
3231
3332** \* ** Some strategies allow the version to be incremented, others don't. More
3433info below.
3534** +** This version is out of context with the rest of the example. It is here
3635simply to show what happens if the check is true.
3736
38- ### Base Version Strategies
37+ ### Version Strategies
3938
4039Currently we have the following strategies:
4140
42- * ` HighestTagBaseVersionStrategy ` - Finds the highest reachable tag from the
43- current branch
44- * ` VersionInBranchBaseVersionStrategy ` - Extracts version information from the
45- branch name (e.g., ` release/3.0.0 ` will find ` 3.0.0 ` )
46- * ` ConfigNextVersionBaseVersionStrategy ` - Returns the version from the
47- GitVersion.yaml file
48- * ` MergeMessageBaseVersionStrategy ` - Finds version numbers from merge messages
49- (e.g., ` Merge 'release/3.0.0' into 'main' ` will return ` 3.0.0 ` )
50- * ` FallbackBaseVersionStrategy ` - Always returns 0.0.0 and will be used for
41+ * ` Fallback ` - Always returns 0.0.0 and will be used for
5142 calculating the next version which is dependent on the increment strategy of
52- the effected branch (e.g. on main the next version is 0.0.1 or on develop it is 0.1.0)
43+ the effected branch (e.g. on main the next version is 0.0.1 or on develop it is 0.1.0).
44+ The fallback strategy only applies if no other selected strategy returns a base version.
45+ * ` ConfiguredNextVersion ` - Returns the version from the GitVersion.yaml file
46+ * ` MergeMessage ` - Finds version numbers from merge messages
47+ (e.g., ` Merge 'release/3.0.0' into 'main' ` will return ` 3.0.0 ` )
48+ * ` TaggedCommit ` - Extracts version information from all tags on the branch which are valid,
49+ and not newer than the current commit.
50+ * ` TrackReleaseBranches ` - Considers the base version extracted from release branches when
51+ calculating the next version for branches configured with ` track-release-branches: true `
52+ (part of default configuration for ` develop ` branch in ` GitFlow ` workflow)
53+ * ` VersionInBranchName ` - Extracts version information from the
54+ branch name (e.g., ` release/3.0.0 ` will find ` 3.0.0 ` )
55+ * ` Mainline ` - Increments the version on every commit for branches configured with ` is-main-branch: true `
5356
5457Each strategy needs to return an instance of ` BaseVersion ` which has the
5558following properties:
5659
5760* ` Source ` - Description of the source (e.g., ` Merge message 'Merge 'release/3.0.0' into 'main' ` )
5861* ` ShouldIncrement ` - Some strategies should have the version incremented,
59- others do not (e.g., ` ConfigNextVersionBaseVersionStrategy ` returns false,
60- ` HighestTagBaseVersionStrategy ` returns true)
62+ others do not (e.g., ` ConfiguredNextVersion ` returns false,
63+ ` TaggedCommit ` returns true)
6164* ` SemanticVersion ` - SemVer of the base version strategy
6265* ` BaseVersionSource ` - SHA hash of the source. Commits will be counted from
63- this hash. Can be null (e.g., ` ConfigNextVersionBaseVersionStrategy ` returns
66+ this hash. Can be null (e.g., ` ConfiguredNextVersion ` returns
6467 null).
6568* ` BranchNameOverride ` - When ` useBranchName ` or ` {BranchName} ` is used in the
6669 tag configuration, this allows the branch name to be changed by a base version.
67- ` VersionInBranchBaseVersionStrategy ` uses this to strip out anything before the
70+ ` VersionInBranchName ` uses this to strip out anything before the
6871 first ` - ` or ` /. ` so ` foo ` ends up being evaluated as ` foo ` . If in doubt, just
6972 use null.
0 commit comments