diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md
index 69e304e7ca..f0cc4a86f1 100644
--- a/docs/input/docs/reference/configuration.md
+++ b/docs/input/docs/reference/configuration.md
@@ -41,98 +41,65 @@ The built-in configuration for the `GitFlow` workflow (`workflow: GitFlow/v1`) l
```yml
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - Fallback
- - ConfiguredNextVersion
- - MergeMessage
- - TaggedCommit
- - TrackReleaseBranches
- - VersionInBranchName
+assembly-versioning-scheme: MajorMinorPatch
branches:
develop:
- mode: ContinuousDelivery
- label: alpha
increment: Minor
+ is-main-branch: false
+ is-release-branch: false
+ is-source-branch-for: []
+ label: alpha
+ mode: ContinuousDelivery
+ pre-release-weight: 0
prevent-increment:
when-current-commit-tagged: false
- track-merge-target: true
- track-merge-message: true
regex: ^dev(elop)?(ment)?$
source-branches:
- main
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: true
tracks-release-branches: true
- is-release-branch: false
- is-main-branch: false
- pre-release-weight: 0
main:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
release:
- mode: ManualDeployment
- label: beta
increment: Minor
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-target: false
regex: "^releases?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
feature:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- develop
@@ -140,17 +107,16 @@ branches:
- release
- support
- hotfix
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- develop
@@ -159,40 +125,41 @@ branches:
- feature
- support
- hotfix
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
hotfix:
- mode: ManualDeployment
- label: beta
increment: Inherit
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "^hotfix(es)?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
support:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
regex: "^support[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
unknown:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
prevent-increment:
when-current-commit-tagged: true
regex: "(?.+)"
@@ -204,50 +171,29 @@ branches:
- pull-request
- hotfix
- support
- is-source-branch-for: []
- is-main-branch: false
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
-```
-snippet source | anchor
-
-
-The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
-
-
-
-```yml
-mode: ContinuousDelivery
-label: "{BranchName}"
+ sha: []
increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
prevent-increment:
of-merged-branch: false
when-branch-merged: false
when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
-assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
semantic-version-format: Strict
+source-branches: []
strategies:
- Fallback
- ConfiguredNextVersion
@@ -255,86 +201,140 @@ strategies:
- TaggedCommit
- TrackReleaseBranches
- VersionInBranchName
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
+```
+snippet source | anchor
+
+
+The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
+
+
+
+```yml
+assembly-file-versioning-scheme: MajorMinorPatch
+assembly-versioning-scheme: MajorMinorPatch
branches:
main:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
release:
- mode: ManualDeployment
- label: beta
increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-branch-merged: false
when-current-commit-tagged: false
- track-merge-target: false
- track-merge-message: true
regex: "^releases?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
feature:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- main
- release
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- main
- release
- feature
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
unknown:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
- prevent-increment:
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
when-current-commit-tagged: false
- track-merge-message: false
regex: "(?.+)"
source-branches:
- main
- release
- feature
- pull-request
- is-source-branch-for: []
- is-main-branch: false
+ track-merge-message: false
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - Fallback
+ - ConfiguredNextVersion
+ - MergeMessage
+ - TaggedCommit
+ - TrackReleaseBranches
+ - VersionInBranchName
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
```
snippet source | anchor
@@ -344,153 +344,114 @@ The preview built-in configuration (experimental usage only) for the `TrunkBased
```yml
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - ConfiguredNextVersion
- - Mainline
+assembly-versioning-scheme: MajorMinorPatch
branches:
main:
- mode: ContinuousDeployment
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ mode: ContinuousDeployment
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
feature:
- mode: ContinuousDelivery
- label: "{BranchName}"
increment: Minor
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
hotfix:
- mode: ContinuousDelivery
- label: "{BranchName}"
increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "^hotfix(es)?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- main
- feature
- hotfix
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
unknown:
increment: Patch
+ is-source-branch-for: []
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "(?.+)"
source-branches:
- main
- is-source-branch-for: []
- pre-release-weight: 30000
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - ConfiguredNextVersion
+ - Mainline
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
```
snippet source | anchor
The details of the available options are as follows:
-### workflow
-
-The base template of the configuration to use. Possible values are `GitFlow/v1` or `GitHubFlow/v1`. Defaults to `GitFlow/v1` if not set. To create a configuration from scratch without using a base template, please specify an empty string.
-
-### next-version
-
-Allows you to bump the next version explicitly. Useful for bumping `main` or a
-feature branch with breaking changes (i.e., a major increment), indicating what
-the next `git tag` is going to be.
-
-`next-version` is not a permanent replacement for `git tag` and should only be
-used intermittently. Since version 5.5 GitVersion supports `next-version` with
-`mode: Mainline` and should not be treated as a "base version".
-
-If you are using `next-version` and are experiencing weird versioning behaviour,
-please remove it, create a `git tag` with an appropriate version number on an
-appropriate historical commit and see if that resolves any versioning issues
-you may have.
-
-### assembly-versioning-scheme
-
-When updating assembly info, `assembly-versioning-scheme` tells GitVersion how
-to treat the `AssemblyVersion` attribute. Useful to lock the major when using
-Strong Naming. Note: you can use `None` to skip updating the `AssemblyVersion`
-while still updating the `AssemblyFileVersion` and `AssemblyInformationVersion`
-attributes. Valid values: `MajorMinorPatchTag`, `MajorMinorPatch`, `MajorMinor`,
-`Major`, `None`.
-
-For information on using format strings in these properties, see
-[Format Strings](/docs/reference/custom-formatting).
-
-### assembly-file-versioning-scheme
-
-When updating assembly info, `assembly-file-versioning-scheme` tells GitVersion
-how to treat the `AssemblyFileVersion` attribute. Note: you can use `None` to
-skip updating the `AssemblyFileVersion` while still updating the
-`AssemblyVersion` and `AssemblyInformationVersion` attributes. Valid values:
-`MajorMinorPatchTag`, `MajorMinorPatch`, `MajorMinor`, `Major`, `None`.
-
### assembly-file-versioning-format
Specifies the format of `AssemblyFileVersion` and
@@ -510,11 +471,13 @@ assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER}'
assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER ?? 42}'
```
-### assembly-versioning-format
+### assembly-file-versioning-scheme
-Specifies the format of `AssemblyVersion` and
-overwrites the value of `assembly-versioning-scheme`.
-Follows the same formatting semantics as `assembly-file-versioning-format`.
+When updating assembly info, `assembly-file-versioning-scheme` tells GitVersion
+how to treat the `AssemblyFileVersion` attribute. Note: you can use `None` to
+skip updating the `AssemblyFileVersion` while still updating the
+`AssemblyVersion` and `AssemblyInformationVersion` attributes. Valid values:
+`MajorMinorPatchTag`, `MajorMinorPatch`, `MajorMinor`, `Major`, `None`.
### assembly-informational-format
@@ -522,94 +485,140 @@ Specifies the format of `AssemblyInformationalVersion`.
Follows the same formatting semantics as `assembly-file-versioning-format`.
The default value is `{InformationalVersion}`.
-### custom-version-format
+### assembly-versioning-format
-Specifies the format of the `CustomVersion` output variable.
-Follows the same formatting semantics as `assembly-file-versioning-format` and
-can use version variables or environment variables. `CustomVersion` is empty
-when no format is configured. The format can be configured globally and
-overridden for individual branches under `branches`.
+Specifies the format of `AssemblyVersion` and
+overwrites the value of `assembly-versioning-scheme`.
+Follows the same formatting semantics as `assembly-file-versioning-format`.
-### mode
+### assembly-versioning-scheme
-Sets the `mode` of how GitVersion should create a new version. Read more at
-[deployment modes][modes].
+When updating assembly info, `assembly-versioning-scheme` tells GitVersion how
+to treat the `AssemblyVersion` attribute. Useful to lock the major when using
+Strong Naming. Note: you can use `None` to skip updating the `AssemblyVersion`
+while still updating the `AssemblyFileVersion` and `AssemblyInformationVersion`
+attributes. Valid values: `MajorMinorPatchTag`, `MajorMinorPatch`, `MajorMinor`,
+`Major`, `None`.
-### increment
+For information on using format strings in these properties, see
+[Format Strings](/docs/reference/custom-formatting).
-The part of the SemVer to increment when GitVersion detects it needs to be
-increased, such as for commits after a tag: `Major`, `Minor`, `Patch`, `None`.
+### branches
-The special value `Inherit` means that GitVersion should find the parent branch
-(i.e. the branch where the current branch was branched from), and use its values
-for [increment](#increment) or other branch related properties.
+The header for all the individual branch configuration.
-For a synthetic pull request merge ref, GitVersion uses the `TargetBranch`
-captured from the merge commit message as the immediate parent when it matches
-an allowed source branch. If the message has no matching target, GitVersion
-falls back to Git ancestry, as it does for ordinary branches.
+### increment
-### tag-prefix
+Same as for the [global configuration, explained above](#increment).
-A regular expression which is used to trim Git tags before processing (e.g.,
-v1.0.0). The default value is `[vV]`.
+### is-main-branch
-### version-in-branch-pattern
+This indicates that this branch is a main branch. By default `main` and `support/*` are main branches.
-A regular expression which is used to determine the version number in the branch
-name or commit message (e.g., v1.0.0-LTS). This setting only applies on branches
-where the option `is-release-branch` is set to `true`. The default value is
-`(?[vV]?\d+(\.\d+)?(\.\d+)?).*`.
+### is-release-branch
-### major-version-bump-message
+Indicates this branch config represents a release branch in GitFlow.
-The regex to match commit messages with to perform a major version increment.
-Default set to `'[+=]semver:\s?(breaking|major)'`, which will match occurrences
-of `+semver: major`, `=semver: major`, and the corresponding `breaking` forms.
+### label
-### minor-version-bump-message
+The pre-release label to use for this branch. Use the value `{BranchName}` as a placeholder to
+insert the value of the named group `BranchName` from the [regular expression](#regex).
-The regex to match commit messages with to perform a minor version increment.
-Default set to `'[+=]semver:\s?(feature|minor)'`, which will match occurrences
-of `+semver: minor`, `=semver: minor`, and the corresponding `feature` forms.
+For example: branch `feature/foo` would become a pre-release label
+of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`.
-### patch-version-bump-message
+Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`.
-The regex to match commit messages with to perform a patch version increment.
-Default set to `'[+=]semver:\s?(fix|patch)'`, which will match occurrences of
-`+semver: patch`, `=semver: patch`, and the corresponding `fix` forms.
+You can also use environment variable placeholders with the `{env:VARIABLE_NAME}` syntax. Environment variable placeholders can also be combined with regex placeholders, for example `{BranchName}-{env:VARIABLE_NAME}`, and support fallback values using the `{env:VARIABLE_NAME ?? "fallback"}` syntax. These can be combined with cascading fallbacks using environment variables and placeholders like this: `{env:VARIABLE_NAME ?? BranchName ?? "fallback"}`.
-### no-bump-message
+**Note:** To clear a default use an empty string: `label: ''`
-Used to tell GitVersion not to increment when in Mainline development mode.
-Default `[+=]semver:\s?(none|skip)`, which will match both the `+semver` and
-`=semver` forms of `none` and `skip`.
+### label-number-pattern
-When a commit matches **both** the `no-bump-message` **and** any combination of
-the `version-bump-message`, `no-bump-message` takes precedence and no increment is applied.
+Pull requests require us to extract the pre-release number out of the branch
+name so `refs/pull/534/merge` builds as `PullRequest534`. This is a regex with
+a named capture group called `Number`.
-### version-bump-reset-message
+**Example usage:**
-The regex to match a commit message that resets the version bump baseline and
-suppresses the configured branch increment. The default is `=semver:`. The
-increment itself is still selected by the major, minor, patch, and no-bump
-message patterns above, whose defaults accept both `+semver` and `=semver`.
+```yaml
+branches:
+ pull-request:
+ mode: ContinuousDelivery
+ label: PullRequest{Number}
+ increment: Inherit
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ track-merge-message: true
+ regex: ^(pull-requests|pull|pr)[\/-](?\d*)
+ source-branches:
+ - main
+ - release
+ - feature
+ is-source-branch-for: []
+ pre-release-weight: 30000
+```
-For example, when a branch is configured with `increment: Patch`, a commit
-containing `=semver: none` keeps the current version and a commit containing
-`=semver: minor` selects a minor increment. Unlike the `+semver` form, the `=`
-form resets earlier commit-message increments in the calculation range and can
-lower the configured increment. This setting follows
-`commit-message-incrementing`.
+### mode
-### tag-pre-release-weight
+Same as for the [global configuration, explained above](#mode).
-The pre-release weight in case of tagged commits. If the value is not set in the
-configuration, a default weight of 60000 is used instead. If the
-`WeightedPreReleaseNumber` [variable][variables] is 0 and this parameter is set,
-its value is used. This helps if your branching model is GitFlow and the last
-release build, which is often tagged, can utilize this parameter to produce a
-monotonically increasing build number.
+### pre-release-weight
+
+Provides a way to translate the `PreReleaseLabelName` ([variables][variables]) to a numeric
+value in order to avoid version collisions across different branches. For
+example, a release branch created after "1.2.3-alpha.55" results in
+"1.2.3-beta.1" and thus e.g. "1.2.3-alpha.4" and "1.2.3-beta.4" would have the
+same file version: "1.2.3.4". One of the ways to use this value is to set
+`assembly-file-versioning-format:
+{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}`. If the `pre-release-weight`
+is set, it would be added to the `PreReleaseNumber` to get a final
+`AssemblySemFileVer`, otherwise a branch specific default for
+`pre-release-weight` will be used in the calculation. Related Issues [1145][1145]
+and [1366][1366].
+
+### prevent-increment-of-merged-branch
+
+The increment of the branch merged to will be ignored, regardless of whether the merged branch has a version number or not, when this branch related property is set to true on the target branch.
+
+When `release-2.0.0` is merged into main, we want main to build `2.0.0`. If
+`release-2.0.0` is merged into develop we want it to build `2.1.0`, this option
+prevents incrementing after a versioned branch is merged.
+
+In a GitFlow-based repository, setting this option can have implications on the
+`VersionSourceDistance` output variable. It can rule out a potentially
+better version source proposed by the `MergeMessageBaseVersionStrategy`. For
+more details and an in-depth analysis, please see [the discussion][2506].
+
+### prevent-increment-when-branch-merged
+
+The increment of the merged branch will be ignored when this branch related property is set to `true` on the source branch.
+
+### prevent-increment-when-current-commit-tagged
+
+This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.
+
+### track-merge-message
+
+This property is a branch related property and gives the user the possibility to control the behavior of whether the merge
+commit message will be interpreted as a next version or not. Consider we have a main branch and a `release/1.0.0` branch and
+merge changes from `release/1.0.0` to the `main` branch. If `track-merge-message` is set to `true` then the next version will
+be `1.0.0` otherwise `0.0.1`.
+
+### track-merge-target
+
+Strategy which will look for tagged merge commits directly off the current
+branch. For example `develop` → `release/1.0.0` → merge into `main` and tag
+`1.0.0`. The tag is *not* on develop, but develop should be version `1.0.0` now.
+
+### tracks-release-branches
+
+Indicates this branch config represents develop in GitFlow.
+
+### commit-date-format
+
+Sets the format which will be used to format the `CommitDate` output variable.
### commit-message-incrementing
@@ -617,9 +626,13 @@ Sets whether it should be possible to increment the version with special syntax
in the commit message. See the `*-version-bump-message` options above for
details on the syntax. Default set to `Enabled`; set to `Disabled` to disable.
-### commit-date-format
+### custom-version-format
-Sets the format which will be used to format the `CommitDate` output variable.
+Specifies the format of the `CustomVersion` output variable.
+Follows the same formatting semantics as `assembly-file-versioning-format` and
+can use version variables or environment variables. `CustomVersion` is empty
+when no format is configured. The format can be configured globally and
+overridden for individual branches under `branches`.
### ignore
@@ -631,26 +644,6 @@ the search for a [version source][version-sources], not when calculating other
parts of the version number, such as build metadata.
:::
-#### sha
-
-A sequence of SHAs to be excluded from the version calculations. Useful when
-there is a rogue commit in history yielding a bad version. You can use either
-style below:
-
-```yaml
-ignore:
- sha: [e7bc24c0f34728a25c9187b8d0b041d935763e3a, 764e16321318f2fdb9cdeaa56d1156a1cba307d7]
-```
-
-or
-
-```yaml
-ignore:
- sha:
- - e7bc24c0f34728a25c9187b8d0b041d935763e3a
- - 764e16321318f2fdb9cdeaa56d1156a1cba307d7
-```
-
#### commits-before
Date and time in the format `yyyy-MM-ddTHH:mm:ss` (eg `commits-before:
@@ -706,6 +699,79 @@ This can lead to unexpected behavior on case-insensitive file systems, such as W
A commit is ignored by the `ignore.paths` configuration only if **all paths** changed in that commit match one or more of the specified regular expressions. If a path in a commit does not match any one of the ignore patterns, that commit will be included in version calculations.
:::
+#### sha
+
+A sequence of SHAs to be excluded from the version calculations. Useful when
+there is a rogue commit in history yielding a bad version. You can use either
+style below:
+
+```yaml
+ignore:
+ sha: [e7bc24c0f34728a25c9187b8d0b041d935763e3a, 764e16321318f2fdb9cdeaa56d1156a1cba307d7]
+```
+
+or
+
+```yaml
+ignore:
+ sha:
+ - e7bc24c0f34728a25c9187b8d0b041d935763e3a
+ - 764e16321318f2fdb9cdeaa56d1156a1cba307d7
+```
+
+### increment
+
+The part of the SemVer to increment when GitVersion detects it needs to be
+increased, such as for commits after a tag: `Major`, `Minor`, `Patch`, `None`.
+
+The special value `Inherit` means that GitVersion should find the parent branch
+(i.e. the branch where the current branch was branched from), and use its values
+for [increment](#increment) or other branch related properties.
+
+For a synthetic pull request merge ref, GitVersion uses the `TargetBranch`
+captured from the merge commit message as the immediate parent when it matches
+an allowed source branch. If the message has no matching target, GitVersion
+falls back to Git ancestry, as it does for ordinary branches.
+
+### is-source-branch-for
+
+The reverse of `source-branches`. This property was introduced to keep it easy
+to extend GitVersion's config.
+
+It exists to make it easier to extend GitVersion's configuration. If only
+`source-branches` exists and you add a new branch type, for instance
+`unstable/`, you then need to re-define the `source-branches` configuration
+value for existing branches (like feature/) to now include the new unstable
+branch.
+
+A complete example:
+
+```yaml
+branches:
+ unstable:
+ regex: ...
+ is-source-branch-for: ['main', 'develop', 'feature', 'hotfix', 'support']
+```
+
+Without this configuration value you would have to do:
+
+```yaml
+branches:
+ unstable:
+ regex:
+ feature:
+ source-branches: ['unstable', 'develop', 'feature', 'hotfix', 'support']
+ release:
+ source-branches: ['unstable', 'develop']
+ etc...
+```
+
+### major-version-bump-message
+
+The regex to match commit messages with to perform a major version increment.
+Default set to `'[+=]semver:\s?(breaking|major)'`, which will match occurrences
+of `+semver: major`, `=semver: major`, and the corresponding `breaking` forms.
+
### merge-message-formats
Custom merge message formats to enable identification of merge messages that do not
@@ -724,9 +790,156 @@ The regular expression should contain the following capture groups:
* `TargetBranch` - Identifies the target branch of the merge
* `PullRequestNumber` - Captures the pull-request number
-Custom merge message formats are evaluated *before* any built in formats.
-Support for [Conventional Commits][conventional-commits] can be
-[configured][conventional-commits-config].
+Custom merge message formats are evaluated *before* any built in formats.
+Support for [Conventional Commits][conventional-commits] can be
+[configured][conventional-commits-config].
+
+### minor-version-bump-message
+
+The regex to match commit messages with to perform a minor version increment.
+Default set to `'[+=]semver:\s?(feature|minor)'`, which will match occurrences
+of `+semver: minor`, `=semver: minor`, and the corresponding `feature` forms.
+
+### mode
+
+Sets the `mode` of how GitVersion should create a new version. Read more at
+[deployment modes][modes].
+
+### next-version
+
+Allows you to bump the next version explicitly. Useful for bumping `main` or a
+feature branch with breaking changes (i.e., a major increment), indicating what
+the next `git tag` is going to be.
+
+`next-version` is not a permanent replacement for `git tag` and should only be
+used intermittently. Since version 5.5 GitVersion supports `next-version` with
+`mode: Mainline` and should not be treated as a "base version".
+
+If you are using `next-version` and are experiencing weird versioning behaviour,
+please remove it, create a `git tag` with an appropriate version number on an
+appropriate historical commit and see if that resolves any versioning issues
+you may have.
+
+### no-bump-message
+
+Used to tell GitVersion not to increment when in Mainline development mode.
+Default `[+=]semver:\s?(none|skip)`, which will match both the `+semver` and
+`=semver` forms of `none` and `skip`.
+
+When a commit matches **both** the `no-bump-message` **and** any combination of
+the `version-bump-message`, `no-bump-message` takes precedence and no increment is applied.
+
+### patch-version-bump-message
+
+The regex to match commit messages with to perform a patch version increment.
+Default set to `'[+=]semver:\s?(fix|patch)'`, which will match occurrences of
+`+semver: patch`, `=semver: patch`, and the corresponding `fix` forms.
+
+### regex
+
+This is the regex which is used to match the current branch to the correct
+branch configuration.
+
+[Named groups](https://learn.microsoft.com/en-us/dotnet/standard/base-types/grouping-constructs-in-regular-expressions#named-matched-subexpressions) can be used to dynamically label pre-releases based on the branch name, or parts of it. See [Label](#label) for more details and examples.
+
+### semantic-version-format
+
+Specifies the semantic version format that is used when parsing the string.
+Can be `Strict` - using the [regex](https://regex101.com/r/Ly7O1x/3/)
+or `Loose` the old way of parsing. The default if not specified is `Strict`
+Example of invalid `Strict`, but valid `Loose`
+
+```log
+1.2-alpha4
+01.02.03-rc03
+1.2.3.4
+```
+
+### source-branches
+
+Because Git commits only refer to parent commits (not branches) GitVersion
+sometimes cannot tell which branch the current branch was branched from.
+
+Take this commit graph
+
+```shell
+* release/v1.0.0 * feature/foo
+| ________________/
+|/
+*
+*
+* (main)
+```
+
+By looking at this graph, you cannot tell which of these scenarios happened:
+
+* feature/foo branches off release/v1.0.0
+ * Branch release/v1.0.0 from main
+ * Branch feature/foo from release/v1.0.0
+ * Add a commit to both release/v1.0.0 and feature/foo
+ * release/v1.0.0 is the base for feature/foo
+* release/v1.0.0 branches off feature/foo
+ * Branch feature/foo from main
+ * Branch release/v1.0.0 from feature/foo
+ * Add a commit to both release/v1.0.0 and feature/foo
+ * feature/foo is the base for release/v1.0.0
+
+Or put more simply, you cannot tell which branch was created first,
+`release/v1.0.0` or `feature/foo`.
+
+To resolve this issue, we give GitVersion a hint about our branching workflows
+by telling it what types of branches a branch can be created from. For example,
+feature branches are, by default, configured to have the following source
+branches:
+
+`source-branches: ['main', 'develop', 'feature', 'hotfix', 'support']`
+
+This means that we will never bother to evaluate pull request branches as merge
+base options and being explicit in this way also improves the performance of
+GitVersion.
+
+### strategies
+
+Specifies which version strategy implementation (one or more) will be used to determine the next version.
+These strategies can be combined, and the order in which they are specified does not matter.
+The configuration accepts the following values:
+
+* Fallback
+* ConfiguredNextVersion
+* MergeMessage
+* TaggedCommit
+* TrackReleaseBranches
+* VersionInBranchName
+* Mainline
+
+[1145]: https://github.com/GitTools/GitVersion/issues/1145
+
+[1366]: https://github.com/GitTools/GitVersion/issues/1366
+
+[2506]: https://github.com/GitTools/GitVersion/pull/2506#issuecomment-754754037
+
+[conventional-commits-config]: /docs/reference/version-increments#conventional-commit-messages
+
+[conventional-commits]: https://www.conventionalcommits.org/
+
+[modes]: /docs/reference/modes
+
+[variables]: /docs/reference/variables
+
+[version-sources]: /docs/reference/version-sources
+### tag-pre-release-weight
+
+The pre-release weight in case of tagged commits. If the value is not set in the
+configuration, a default weight of 60000 is used instead. If the
+`WeightedPreReleaseNumber` [variable][variables] is 0 and this parameter is set,
+its value is used. This helps if your branching model is GitFlow and the last
+release build, which is often tagged, can utilize this parameter to produce a
+monotonically increasing build number.
+
+### tag-prefix
+
+A regular expression which is used to trim Git tags before processing (e.g.,
+v1.0.0). The default value is `[vV]`.
### update-build-number
@@ -832,241 +1045,27 @@ used (recommended).
We don't envision many people needing to change most of these configuration
values, but here they are if you need to:
-### regex
-
-This is the regex which is used to match the current branch to the correct
-branch configuration.
-
-[Named groups](https://learn.microsoft.com/en-us/dotnet/standard/base-types/grouping-constructs-in-regular-expressions#named-matched-subexpressions) can be used to dynamically label pre-releases based on the branch name, or parts of it. See [Label](#label) for more details and examples.
-
-### source-branches
-
-Because Git commits only refer to parent commits (not branches) GitVersion
-sometimes cannot tell which branch the current branch was branched from.
-
-Take this commit graph
-
-```shell
-* release/v1.0.0 * feature/foo
-| ________________/
-|/
-*
-*
-* (main)
-```
-
-By looking at this graph, you cannot tell which of these scenarios happened:
-
-* feature/foo branches off release/v1.0.0
- * Branch release/v1.0.0 from main
- * Branch feature/foo from release/v1.0.0
- * Add a commit to both release/v1.0.0 and feature/foo
- * release/v1.0.0 is the base for feature/foo
-* release/v1.0.0 branches off feature/foo
- * Branch feature/foo from main
- * Branch release/v1.0.0 from feature/foo
- * Add a commit to both release/v1.0.0 and feature/foo
- * feature/foo is the base for release/v1.0.0
-
-Or put more simply, you cannot tell which branch was created first,
-`release/v1.0.0` or `feature/foo`.
-
-To resolve this issue, we give GitVersion a hint about our branching workflows
-by telling it what types of branches a branch can be created from. For example,
-feature branches are, by default, configured to have the following source
-branches:
-
-`source-branches: ['main', 'develop', 'feature', 'hotfix', 'support']`
-
-This means that we will never bother to evaluate pull request branches as merge
-base options and being explicit in this way also improves the performance of
-GitVersion.
-
-### is-source-branch-for
-
-The reverse of `source-branches`. This property was introduced to keep it easy
-to extend GitVersion's config.
-
-It exists to make it easier to extend GitVersion's configuration. If only
-`source-branches` exists and you add a new branch type, for instance
-`unstable/`, you then need to re-define the `source-branches` configuration
-value for existing branches (like feature/) to now include the new unstable
-branch.
-
-A complete example:
-
-```yaml
-branches:
- unstable:
- regex: ...
- is-source-branch-for: ['main', 'develop', 'feature', 'hotfix', 'support']
-```
-
-Without this configuration value you would have to do:
-
-```yaml
-branches:
- unstable:
- regex:
- feature:
- source-branches: ['unstable', 'develop', 'feature', 'hotfix', 'support']
- release:
- source-branches: ['unstable', 'develop']
- etc...
-```
-
-### branches
-
-The header for all the individual branch configuration.
-
-### mode
-
-Same as for the [global configuration, explained above](#mode).
-
-### label
-
-The pre-release label to use for this branch. Use the value `{BranchName}` as a placeholder to
-insert the value of the named group `BranchName` from the [regular expression](#regex).
-
-For example: branch `feature/foo` would become a pre-release label
-of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`.
-
-Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`.
-
-You can also use environment variable placeholders with the `{env:VARIABLE_NAME}` syntax. Environment variable placeholders can also be combined with regex placeholders, for example `{BranchName}-{env:VARIABLE_NAME}`, and support fallback values using the `{env:VARIABLE_NAME ?? "fallback"}` syntax. These can be combined with cascading fallbacks using environment variables and placeholders like this: `{env:VARIABLE_NAME ?? BranchName ?? "fallback"}`.
-
-**Note:** To clear a default use an empty string: `label: ''`
-
-### increment
-
-Same as for the [global configuration, explained above](#increment).
-
-### prevent-increment-of-merged-branch
-
-The increment of the branch merged to will be ignored, regardless of whether the merged branch has a version number or not, when this branch related property is set to true on the target branch.
-
-When `release-2.0.0` is merged into main, we want main to build `2.0.0`. If
-`release-2.0.0` is merged into develop we want it to build `2.1.0`, this option
-prevents incrementing after a versioned branch is merged.
-
-In a GitFlow-based repository, setting this option can have implications on the
-`VersionSourceDistance` output variable. It can rule out a potentially
-better version source proposed by the `MergeMessageBaseVersionStrategy`. For
-more details and an in-depth analysis, please see [the discussion][2506].
-
-### prevent-increment-when-branch-merged
-
-The increment of the merged branch will be ignored when this branch related property is set to `true` on the source branch.
-
-### prevent-increment-when-current-commit-tagged
-
-This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.
-
-### label-number-pattern
-
-Pull requests require us to extract the pre-release number out of the branch
-name so `refs/pull/534/merge` builds as `PullRequest534`. This is a regex with
-a named capture group called `Number`.
-
-**Example usage:**
-
-```yaml
-branches:
- pull-request:
- mode: ContinuousDelivery
- label: PullRequest{Number}
- increment: Inherit
- prevent-increment:
- of-merged-branch: true
- when-current-commit-tagged: false
- track-merge-message: true
- regex: ^(pull-requests|pull|pr)[\/-](?\d*)
- source-branches:
- - main
- - release
- - feature
- is-source-branch-for: []
- pre-release-weight: 30000
-```
-
-### track-merge-target
-
-Strategy which will look for tagged merge commits directly off the current
-branch. For example `develop` → `release/1.0.0` → merge into `main` and tag
-`1.0.0`. The tag is *not* on develop, but develop should be version `1.0.0` now.
-
-### track-merge-message
-
-This property is a branch related property and gives the user the possibility to control the behavior of whether the merge
-commit message will be interpreted as a next version or not. Consider we have a main branch and a `release/1.0.0` branch and
-merge changes from `release/1.0.0` to the `main` branch. If `track-merge-message` is set to `true` then the next version will
-be `1.0.0` otherwise `0.0.1`.
-
-### tracks-release-branches
-
-Indicates this branch config represents develop in GitFlow.
-
-### is-release-branch
-
-Indicates this branch config represents a release branch in GitFlow.
-
-### is-main-branch
-
-This indicates that this branch is a main branch. By default `main` and `support/*` are main branches.
-
-### pre-release-weight
-
-Provides a way to translate the `PreReleaseLabelName` ([variables][variables]) to a numeric
-value in order to avoid version collisions across different branches. For
-example, a release branch created after "1.2.3-alpha.55" results in
-"1.2.3-beta.1" and thus e.g. "1.2.3-alpha.4" and "1.2.3-beta.4" would have the
-same file version: "1.2.3.4". One of the ways to use this value is to set
-`assembly-file-versioning-format:
-{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}`. If the `pre-release-weight`
-is set, it would be added to the `PreReleaseNumber` to get a final
-`AssemblySemFileVer`, otherwise a branch specific default for
-`pre-release-weight` will be used in the calculation. Related Issues [1145][1145]
-and [1366][1366].
-
-### semantic-version-format
-
-Specifies the semantic version format that is used when parsing the string.
-Can be `Strict` - using the [regex](https://regex101.com/r/Ly7O1x/3/)
-or `Loose` the old way of parsing. The default if not specified is `Strict`
-Example of invalid `Strict`, but valid `Loose`
-
-```log
-1.2-alpha4
-01.02.03-rc03
-1.2.3.4
-```
-
-### strategies
-
-Specifies which version strategy implementation (one or more) will be used to determine the next version.
-These strategies can be combined, and the order in which they are specified does not matter.
-The configuration accepts the following values:
-
-* Fallback
-* ConfiguredNextVersion
-* MergeMessage
-* TaggedCommit
-* TrackReleaseBranches
-* VersionInBranchName
-* Mainline
-
-[1145]: https://github.com/GitTools/GitVersion/issues/1145
-
-[1366]: https://github.com/GitTools/GitVersion/issues/1366
+### version-bump-reset-message
-[2506]: https://github.com/GitTools/GitVersion/pull/2506#issuecomment-754754037
+The regex to match a commit message that resets the version bump baseline and
+suppresses the configured branch increment. The default is `=semver:`. The
+increment itself is still selected by the major, minor, patch, and no-bump
+message patterns above, whose defaults accept both `+semver` and `=semver`.
-[conventional-commits-config]: /docs/reference/version-increments#conventional-commit-messages
+For example, when a branch is configured with `increment: Patch`, a commit
+containing `=semver: none` keeps the current version and a commit containing
+`=semver: minor` selects a minor increment. Unlike the `+semver` form, the `=`
+form resets earlier commit-message increments in the calculation range and can
+lower the configured increment. This setting follows
+`commit-message-incrementing`.
-[conventional-commits]: https://www.conventionalcommits.org/
+### version-in-branch-pattern
-[modes]: /docs/reference/modes
+A regular expression which is used to determine the version number in the branch
+name or commit message (e.g., v1.0.0-LTS). This setting only applies on branches
+where the option `is-release-branch` is set to `true`. The default value is
+`(?[vV]?\d+(\.\d+)?(\.\d+)?).*`.
-[variables]: /docs/reference/variables
+### workflow
-[version-sources]: /docs/reference/version-sources
+The base template of the configuration to use. Possible values are `GitFlow/v1` or `GitHubFlow/v1`. Defaults to `GitFlow/v1` if not set. To create a configuration from scratch without using a base template, please specify an empty string.
diff --git a/docs/input/docs/reference/mdsource/configuration.source.md b/docs/input/docs/reference/mdsource/configuration.source.md
index ec9d9923e9..658c7602d7 100644
--- a/docs/input/docs/reference/mdsource/configuration.source.md
+++ b/docs/input/docs/reference/mdsource/configuration.source.md
@@ -50,24 +50,44 @@ snippet: /docs/workflows/TrunkBased/preview1.yml
The details of the available options are as follows:
-### workflow
+### assembly-file-versioning-format
-The base template of the configuration to use. Possible values are `GitFlow/v1` or `GitHubFlow/v1`. Defaults to `GitFlow/v1` if not set. To create a configuration from scratch without using a base template, please specify an empty string.
+Specifies the format of `AssemblyFileVersion` and
+overwrites the value of `assembly-file-versioning-scheme`.
-### next-version
+Expressions in curly braces reference one of the [variables][variables]
+or a process-scoped environment variable (when prefixed with `env:`). For example,
-Allows you to bump the next version explicitly. Useful for bumping `main` or a
-feature branch with breaking changes (i.e., a major increment), indicating what
-the next `git tag` is going to be.
+```yaml
+# use a variable if non-null or a fallback value otherwise
+assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber ?? 0}'
-`next-version` is not a permanent replacement for `git tag` and should only be
-used intermittently. Since version 5.5 GitVersion supports `next-version` with
-`mode: Mainline` and should not be treated as a "base version".
+# use an environment variable or raise an error if not available
+assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER}'
-If you are using `next-version` and are experiencing weird versioning behaviour,
-please remove it, create a `git tag` with an appropriate version number on an
-appropriate historical commit and see if that resolves any versioning issues
-you may have.
+# use an environment variable if available or a fallback value otherwise
+assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER ?? 42}'
+```
+
+### assembly-file-versioning-scheme
+
+When updating assembly info, `assembly-file-versioning-scheme` tells GitVersion
+how to treat the `AssemblyFileVersion` attribute. Note: you can use `None` to
+skip updating the `AssemblyFileVersion` while still updating the
+`AssemblyVersion` and `AssemblyInformationVersion` attributes. Valid values:
+`MajorMinorPatchTag`, `MajorMinorPatch`, `MajorMinor`, `Major`, `None`.
+
+### assembly-informational-format
+
+Specifies the format of `AssemblyInformationalVersion`.
+Follows the same formatting semantics as `assembly-file-versioning-format`.
+The default value is `{InformationalVersion}`.
+
+### assembly-versioning-format
+
+Specifies the format of `AssemblyVersion` and
+overwrites the value of `assembly-versioning-scheme`.
+Follows the same formatting semantics as `assembly-file-versioning-format`.
### assembly-versioning-scheme
@@ -81,133 +101,122 @@ attributes. Valid values: `MajorMinorPatchTag`, `MajorMinorPatch`, `MajorMinor`,
For information on using format strings in these properties, see
[Format Strings](/docs/reference/custom-formatting).
-### assembly-file-versioning-scheme
+### branches
-When updating assembly info, `assembly-file-versioning-scheme` tells GitVersion
-how to treat the `AssemblyFileVersion` attribute. Note: you can use `None` to
-skip updating the `AssemblyFileVersion` while still updating the
-`AssemblyVersion` and `AssemblyInformationVersion` attributes. Valid values:
-`MajorMinorPatchTag`, `MajorMinorPatch`, `MajorMinor`, `Major`, `None`.
+The header for all the individual branch configuration.
-### assembly-file-versioning-format
+### increment
-Specifies the format of `AssemblyFileVersion` and
-overwrites the value of `assembly-file-versioning-scheme`.
+Same as for the [global configuration, explained above](#increment).
-Expressions in curly braces reference one of the [variables][variables]
-or a process-scoped environment variable (when prefixed with `env:`). For example,
+### is-main-branch
-```yaml
-# use a variable if non-null or a fallback value otherwise
-assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber ?? 0}'
+This indicates that this branch is a main branch. By default `main` and `support/*` are main branches.
-# use an environment variable or raise an error if not available
-assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER}'
+### is-release-branch
-# use an environment variable if available or a fallback value otherwise
-assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER ?? 42}'
-```
+Indicates this branch config represents a release branch in GitFlow.
-### assembly-versioning-format
+### label
-Specifies the format of `AssemblyVersion` and
-overwrites the value of `assembly-versioning-scheme`.
-Follows the same formatting semantics as `assembly-file-versioning-format`.
+The pre-release label to use for this branch. Use the value `{BranchName}` as a placeholder to
+insert the value of the named group `BranchName` from the [regular expression](#regex).
-### assembly-informational-format
+For example: branch `feature/foo` would become a pre-release label
+of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`.
-Specifies the format of `AssemblyInformationalVersion`.
-Follows the same formatting semantics as `assembly-file-versioning-format`.
-The default value is `{InformationalVersion}`.
+Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`.
-### custom-version-format
+You can also use environment variable placeholders with the `{env:VARIABLE_NAME}` syntax. Environment variable placeholders can also be combined with regex placeholders, for example `{BranchName}-{env:VARIABLE_NAME}`, and support fallback values using the `{env:VARIABLE_NAME ?? "fallback"}` syntax. These can be combined with cascading fallbacks using environment variables and placeholders like this: `{env:VARIABLE_NAME ?? BranchName ?? "fallback"}`.
-Specifies the format of the `CustomVersion` output variable.
-Follows the same formatting semantics as `assembly-file-versioning-format` and
-can use version variables or environment variables. `CustomVersion` is empty
-when no format is configured. The format can be configured globally and
-overridden for individual branches under `branches`.
+**Note:** To clear a default use an empty string: `label: ''`
-### mode
+### label-number-pattern
-Sets the `mode` of how GitVersion should create a new version. Read more at
-[deployment modes][modes].
+Pull requests require us to extract the pre-release number out of the branch
+name so `refs/pull/534/merge` builds as `PullRequest534`. This is a regex with
+a named capture group called `Number`.
-### increment
+**Example usage:**
-The part of the SemVer to increment when GitVersion detects it needs to be
-increased, such as for commits after a tag: `Major`, `Minor`, `Patch`, `None`.
+```yaml
+branches:
+ pull-request:
+ mode: ContinuousDelivery
+ label: PullRequest{Number}
+ increment: Inherit
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ track-merge-message: true
+ regex: ^(pull-requests|pull|pr)[\/-](?\d*)
+ source-branches:
+ - main
+ - release
+ - feature
+ is-source-branch-for: []
+ pre-release-weight: 30000
+```
-The special value `Inherit` means that GitVersion should find the parent branch
-(i.e. the branch where the current branch was branched from), and use its values
-for [increment](#increment) or other branch related properties.
+### mode
-For a synthetic pull request merge ref, GitVersion uses the `TargetBranch`
-captured from the merge commit message as the immediate parent when it matches
-an allowed source branch. If the message has no matching target, GitVersion
-falls back to Git ancestry, as it does for ordinary branches.
+Same as for the [global configuration, explained above](#mode).
-### tag-prefix
+### pre-release-weight
-A regular expression which is used to trim Git tags before processing (e.g.,
-v1.0.0). The default value is `[vV]`.
+Provides a way to translate the `PreReleaseLabelName` ([variables][variables]) to a numeric
+value in order to avoid version collisions across different branches. For
+example, a release branch created after "1.2.3-alpha.55" results in
+"1.2.3-beta.1" and thus e.g. "1.2.3-alpha.4" and "1.2.3-beta.4" would have the
+same file version: "1.2.3.4". One of the ways to use this value is to set
+`assembly-file-versioning-format:
+{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}`. If the `pre-release-weight`
+is set, it would be added to the `PreReleaseNumber` to get a final
+`AssemblySemFileVer`, otherwise a branch specific default for
+`pre-release-weight` will be used in the calculation. Related Issues [1145][1145]
+and [1366][1366].
-### version-in-branch-pattern
+### prevent-increment-of-merged-branch
-A regular expression which is used to determine the version number in the branch
-name or commit message (e.g., v1.0.0-LTS). This setting only applies on branches
-where the option `is-release-branch` is set to `true`. The default value is
-`(?[vV]?\d+(\.\d+)?(\.\d+)?).*`.
+The increment of the branch merged to will be ignored, regardless of whether the merged branch has a version number or not, when this branch related property is set to true on the target branch.
-### major-version-bump-message
+When `release-2.0.0` is merged into main, we want main to build `2.0.0`. If
+`release-2.0.0` is merged into develop we want it to build `2.1.0`, this option
+prevents incrementing after a versioned branch is merged.
-The regex to match commit messages with to perform a major version increment.
-Default set to `'[+=]semver:\s?(breaking|major)'`, which will match occurrences
-of `+semver: major`, `=semver: major`, and the corresponding `breaking` forms.
+In a GitFlow-based repository, setting this option can have implications on the
+`VersionSourceDistance` output variable. It can rule out a potentially
+better version source proposed by the `MergeMessageBaseVersionStrategy`. For
+more details and an in-depth analysis, please see [the discussion][2506].
-### minor-version-bump-message
+### prevent-increment-when-branch-merged
-The regex to match commit messages with to perform a minor version increment.
-Default set to `'[+=]semver:\s?(feature|minor)'`, which will match occurrences
-of `+semver: minor`, `=semver: minor`, and the corresponding `feature` forms.
+The increment of the merged branch will be ignored when this branch related property is set to `true` on the source branch.
-### patch-version-bump-message
+### prevent-increment-when-current-commit-tagged
-The regex to match commit messages with to perform a patch version increment.
-Default set to `'[+=]semver:\s?(fix|patch)'`, which will match occurrences of
-`+semver: patch`, `=semver: patch`, and the corresponding `fix` forms.
+This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.
-### no-bump-message
+### track-merge-message
-Used to tell GitVersion not to increment when in Mainline development mode.
-Default `[+=]semver:\s?(none|skip)`, which will match both the `+semver` and
-`=semver` forms of `none` and `skip`.
+This property is a branch related property and gives the user the possibility to control the behavior of whether the merge
+commit message will be interpreted as a next version or not. Consider we have a main branch and a `release/1.0.0` branch and
+merge changes from `release/1.0.0` to the `main` branch. If `track-merge-message` is set to `true` then the next version will
+be `1.0.0` otherwise `0.0.1`.
-When a commit matches **both** the `no-bump-message` **and** any combination of
-the `version-bump-message`, `no-bump-message` takes precedence and no increment is applied.
+### track-merge-target
-### version-bump-reset-message
+Strategy which will look for tagged merge commits directly off the current
+branch. For example `develop` → `release/1.0.0` → merge into `main` and tag
+`1.0.0`. The tag is *not* on develop, but develop should be version `1.0.0` now.
-The regex to match a commit message that resets the version bump baseline and
-suppresses the configured branch increment. The default is `=semver:`. The
-increment itself is still selected by the major, minor, patch, and no-bump
-message patterns above, whose defaults accept both `+semver` and `=semver`.
+### tracks-release-branches
-For example, when a branch is configured with `increment: Patch`, a commit
-containing `=semver: none` keeps the current version and a commit containing
-`=semver: minor` selects a minor increment. Unlike the `+semver` form, the `=`
-form resets earlier commit-message increments in the calculation range and can
-lower the configured increment. This setting follows
-`commit-message-incrementing`.
+Indicates this branch config represents develop in GitFlow.
-### tag-pre-release-weight
+### commit-date-format
-The pre-release weight in case of tagged commits. If the value is not set in the
-configuration, a default weight of 60000 is used instead. If the
-`WeightedPreReleaseNumber` [variable][variables] is 0 and this parameter is set,
-its value is used. This helps if your branching model is GitFlow and the last
-release build, which is often tagged, can utilize this parameter to produce a
-monotonically increasing build number.
+Sets the format which will be used to format the `CommitDate` output variable.
### commit-message-incrementing
@@ -215,9 +224,13 @@ Sets whether it should be possible to increment the version with special syntax
in the commit message. See the `*-version-bump-message` options above for
details on the syntax. Default set to `Enabled`; set to `Disabled` to disable.
-### commit-date-format
+### custom-version-format
-Sets the format which will be used to format the `CommitDate` output variable.
+Specifies the format of the `CustomVersion` output variable.
+Follows the same formatting semantics as `assembly-file-versioning-format` and
+can use version variables or environment variables. `CustomVersion` is empty
+when no format is configured. The format can be configured globally and
+overridden for individual branches under `branches`.
### ignore
@@ -229,26 +242,6 @@ the search for a [version source][version-sources], not when calculating other
parts of the version number, such as build metadata.
:::
-#### sha
-
-A sequence of SHAs to be excluded from the version calculations. Useful when
-there is a rogue commit in history yielding a bad version. You can use either
-style below:
-
-```yaml
-ignore:
- sha: [e7bc24c0f34728a25c9187b8d0b041d935763e3a, 764e16321318f2fdb9cdeaa56d1156a1cba307d7]
-```
-
-or
-
-```yaml
-ignore:
- sha:
- - e7bc24c0f34728a25c9187b8d0b041d935763e3a
- - 764e16321318f2fdb9cdeaa56d1156a1cba307d7
-```
-
#### commits-before
Date and time in the format `yyyy-MM-ddTHH:mm:ss` (eg `commits-before:
@@ -304,16 +297,89 @@ This can lead to unexpected behavior on case-insensitive file systems, such as W
A commit is ignored by the `ignore.paths` configuration only if **all paths** changed in that commit match one or more of the specified regular expressions. If a path in a commit does not match any one of the ignore patterns, that commit will be included in version calculations.
:::
-### merge-message-formats
+#### sha
-Custom merge message formats to enable identification of merge messages that do not
-follow the built-in conventions. Entries should be added as key-value pairs where
-the value is a regular expression.
-e.g.
+A sequence of SHAs to be excluded from the version calculations. Useful when
+there is a rogue commit in history yielding a bad version. You can use either
+style below:
```yaml
-merge-message-formats:
- tfs: '^Merged (?:PR (?\d+)): Merge (?.+) to (?.+)'
+ignore:
+ sha: [e7bc24c0f34728a25c9187b8d0b041d935763e3a, 764e16321318f2fdb9cdeaa56d1156a1cba307d7]
+```
+
+or
+
+```yaml
+ignore:
+ sha:
+ - e7bc24c0f34728a25c9187b8d0b041d935763e3a
+ - 764e16321318f2fdb9cdeaa56d1156a1cba307d7
+```
+
+### increment
+
+The part of the SemVer to increment when GitVersion detects it needs to be
+increased, such as for commits after a tag: `Major`, `Minor`, `Patch`, `None`.
+
+The special value `Inherit` means that GitVersion should find the parent branch
+(i.e. the branch where the current branch was branched from), and use its values
+for [increment](#increment) or other branch related properties.
+
+For a synthetic pull request merge ref, GitVersion uses the `TargetBranch`
+captured from the merge commit message as the immediate parent when it matches
+an allowed source branch. If the message has no matching target, GitVersion
+falls back to Git ancestry, as it does for ordinary branches.
+
+### is-source-branch-for
+
+The reverse of `source-branches`. This property was introduced to keep it easy
+to extend GitVersion's config.
+
+It exists to make it easier to extend GitVersion's configuration. If only
+`source-branches` exists and you add a new branch type, for instance
+`unstable/`, you then need to re-define the `source-branches` configuration
+value for existing branches (like feature/) to now include the new unstable
+branch.
+
+A complete example:
+
+```yaml
+branches:
+ unstable:
+ regex: ...
+ is-source-branch-for: ['main', 'develop', 'feature', 'hotfix', 'support']
+```
+
+Without this configuration value you would have to do:
+
+```yaml
+branches:
+ unstable:
+ regex:
+ feature:
+ source-branches: ['unstable', 'develop', 'feature', 'hotfix', 'support']
+ release:
+ source-branches: ['unstable', 'develop']
+ etc...
+```
+
+### major-version-bump-message
+
+The regex to match commit messages with to perform a major version increment.
+Default set to `'[+=]semver:\s?(breaking|major)'`, which will match occurrences
+of `+semver: major`, `=semver: major`, and the corresponding `breaking` forms.
+
+### merge-message-formats
+
+Custom merge message formats to enable identification of merge messages that do not
+follow the built-in conventions. Entries should be added as key-value pairs where
+the value is a regular expression.
+e.g.
+
+```yaml
+merge-message-formats:
+ tfs: '^Merged (?:PR (?\d+)): Merge (?.+) to (?.+)'
```
The regular expression should contain the following capture groups:
@@ -326,6 +392,153 @@ Custom merge message formats are evaluated *before* any built in formats.
Support for [Conventional Commits][conventional-commits] can be
[configured][conventional-commits-config].
+### minor-version-bump-message
+
+The regex to match commit messages with to perform a minor version increment.
+Default set to `'[+=]semver:\s?(feature|minor)'`, which will match occurrences
+of `+semver: minor`, `=semver: minor`, and the corresponding `feature` forms.
+
+### mode
+
+Sets the `mode` of how GitVersion should create a new version. Read more at
+[deployment modes][modes].
+
+### next-version
+
+Allows you to bump the next version explicitly. Useful for bumping `main` or a
+feature branch with breaking changes (i.e., a major increment), indicating what
+the next `git tag` is going to be.
+
+`next-version` is not a permanent replacement for `git tag` and should only be
+used intermittently. Since version 5.5 GitVersion supports `next-version` with
+`mode: Mainline` and should not be treated as a "base version".
+
+If you are using `next-version` and are experiencing weird versioning behaviour,
+please remove it, create a `git tag` with an appropriate version number on an
+appropriate historical commit and see if that resolves any versioning issues
+you may have.
+
+### no-bump-message
+
+Used to tell GitVersion not to increment when in Mainline development mode.
+Default `[+=]semver:\s?(none|skip)`, which will match both the `+semver` and
+`=semver` forms of `none` and `skip`.
+
+When a commit matches **both** the `no-bump-message` **and** any combination of
+the `version-bump-message`, `no-bump-message` takes precedence and no increment is applied.
+
+### patch-version-bump-message
+
+The regex to match commit messages with to perform a patch version increment.
+Default set to `'[+=]semver:\s?(fix|patch)'`, which will match occurrences of
+`+semver: patch`, `=semver: patch`, and the corresponding `fix` forms.
+
+### regex
+
+This is the regex which is used to match the current branch to the correct
+branch configuration.
+
+[Named groups](https://learn.microsoft.com/en-us/dotnet/standard/base-types/grouping-constructs-in-regular-expressions#named-matched-subexpressions) can be used to dynamically label pre-releases based on the branch name, or parts of it. See [Label](#label) for more details and examples.
+
+### semantic-version-format
+
+Specifies the semantic version format that is used when parsing the string.
+Can be `Strict` - using the [regex](https://regex101.com/r/Ly7O1x/3/)
+or `Loose` the old way of parsing. The default if not specified is `Strict`
+Example of invalid `Strict`, but valid `Loose`
+
+```log
+1.2-alpha4
+01.02.03-rc03
+1.2.3.4
+```
+
+### source-branches
+
+Because Git commits only refer to parent commits (not branches) GitVersion
+sometimes cannot tell which branch the current branch was branched from.
+
+Take this commit graph
+
+```shell
+* release/v1.0.0 * feature/foo
+| ________________/
+|/
+*
+*
+* (main)
+```
+
+By looking at this graph, you cannot tell which of these scenarios happened:
+
+* feature/foo branches off release/v1.0.0
+ * Branch release/v1.0.0 from main
+ * Branch feature/foo from release/v1.0.0
+ * Add a commit to both release/v1.0.0 and feature/foo
+ * release/v1.0.0 is the base for feature/foo
+* release/v1.0.0 branches off feature/foo
+ * Branch feature/foo from main
+ * Branch release/v1.0.0 from feature/foo
+ * Add a commit to both release/v1.0.0 and feature/foo
+ * feature/foo is the base for release/v1.0.0
+
+Or put more simply, you cannot tell which branch was created first,
+`release/v1.0.0` or `feature/foo`.
+
+To resolve this issue, we give GitVersion a hint about our branching workflows
+by telling it what types of branches a branch can be created from. For example,
+feature branches are, by default, configured to have the following source
+branches:
+
+`source-branches: ['main', 'develop', 'feature', 'hotfix', 'support']`
+
+This means that we will never bother to evaluate pull request branches as merge
+base options and being explicit in this way also improves the performance of
+GitVersion.
+
+### strategies
+
+Specifies which version strategy implementation (one or more) will be used to determine the next version.
+These strategies can be combined, and the order in which they are specified does not matter.
+The configuration accepts the following values:
+
+* Fallback
+* ConfiguredNextVersion
+* MergeMessage
+* TaggedCommit
+* TrackReleaseBranches
+* VersionInBranchName
+* Mainline
+
+[1145]: https://github.com/GitTools/GitVersion/issues/1145
+
+[1366]: https://github.com/GitTools/GitVersion/issues/1366
+
+[2506]: https://github.com/GitTools/GitVersion/pull/2506#issuecomment-754754037
+
+[conventional-commits-config]: /docs/reference/version-increments#conventional-commit-messages
+
+[conventional-commits]: https://www.conventionalcommits.org/
+
+[modes]: /docs/reference/modes
+
+[variables]: /docs/reference/variables
+
+[version-sources]: /docs/reference/version-sources
+### tag-pre-release-weight
+
+The pre-release weight in case of tagged commits. If the value is not set in the
+configuration, a default weight of 60000 is used instead. If the
+`WeightedPreReleaseNumber` [variable][variables] is 0 and this parameter is set,
+its value is used. This helps if your branching model is GitFlow and the last
+release build, which is often tagged, can utilize this parameter to produce a
+monotonically increasing build number.
+
+### tag-prefix
+
+A regular expression which is used to trim Git tags before processing (e.g.,
+v1.0.0). The default value is `[vV]`.
+
### update-build-number
Configures GitVersion to update the build number or not when running on a build server.
@@ -430,241 +643,27 @@ used (recommended).
We don't envision many people needing to change most of these configuration
values, but here they are if you need to:
-### regex
-
-This is the regex which is used to match the current branch to the correct
-branch configuration.
-
-[Named groups](https://learn.microsoft.com/en-us/dotnet/standard/base-types/grouping-constructs-in-regular-expressions#named-matched-subexpressions) can be used to dynamically label pre-releases based on the branch name, or parts of it. See [Label](#label) for more details and examples.
-
-### source-branches
-
-Because Git commits only refer to parent commits (not branches) GitVersion
-sometimes cannot tell which branch the current branch was branched from.
-
-Take this commit graph
-
-```shell
-* release/v1.0.0 * feature/foo
-| ________________/
-|/
-*
-*
-* (main)
-```
-
-By looking at this graph, you cannot tell which of these scenarios happened:
-
-* feature/foo branches off release/v1.0.0
- * Branch release/v1.0.0 from main
- * Branch feature/foo from release/v1.0.0
- * Add a commit to both release/v1.0.0 and feature/foo
- * release/v1.0.0 is the base for feature/foo
-* release/v1.0.0 branches off feature/foo
- * Branch feature/foo from main
- * Branch release/v1.0.0 from feature/foo
- * Add a commit to both release/v1.0.0 and feature/foo
- * feature/foo is the base for release/v1.0.0
-
-Or put more simply, you cannot tell which branch was created first,
-`release/v1.0.0` or `feature/foo`.
-
-To resolve this issue, we give GitVersion a hint about our branching workflows
-by telling it what types of branches a branch can be created from. For example,
-feature branches are, by default, configured to have the following source
-branches:
-
-`source-branches: ['main', 'develop', 'feature', 'hotfix', 'support']`
-
-This means that we will never bother to evaluate pull request branches as merge
-base options and being explicit in this way also improves the performance of
-GitVersion.
-
-### is-source-branch-for
-
-The reverse of `source-branches`. This property was introduced to keep it easy
-to extend GitVersion's config.
-
-It exists to make it easier to extend GitVersion's configuration. If only
-`source-branches` exists and you add a new branch type, for instance
-`unstable/`, you then need to re-define the `source-branches` configuration
-value for existing branches (like feature/) to now include the new unstable
-branch.
-
-A complete example:
-
-```yaml
-branches:
- unstable:
- regex: ...
- is-source-branch-for: ['main', 'develop', 'feature', 'hotfix', 'support']
-```
-
-Without this configuration value you would have to do:
-
-```yaml
-branches:
- unstable:
- regex:
- feature:
- source-branches: ['unstable', 'develop', 'feature', 'hotfix', 'support']
- release:
- source-branches: ['unstable', 'develop']
- etc...
-```
-
-### branches
-
-The header for all the individual branch configuration.
-
-### mode
-
-Same as for the [global configuration, explained above](#mode).
-
-### label
-
-The pre-release label to use for this branch. Use the value `{BranchName}` as a placeholder to
-insert the value of the named group `BranchName` from the [regular expression](#regex).
-
-For example: branch `feature/foo` would become a pre-release label
-of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`.
-
-Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`.
-
-You can also use environment variable placeholders with the `{env:VARIABLE_NAME}` syntax. Environment variable placeholders can also be combined with regex placeholders, for example `{BranchName}-{env:VARIABLE_NAME}`, and support fallback values using the `{env:VARIABLE_NAME ?? "fallback"}` syntax. These can be combined with cascading fallbacks using environment variables and placeholders like this: `{env:VARIABLE_NAME ?? BranchName ?? "fallback"}`.
-
-**Note:** To clear a default use an empty string: `label: ''`
-
-### increment
-
-Same as for the [global configuration, explained above](#increment).
-
-### prevent-increment-of-merged-branch
-
-The increment of the branch merged to will be ignored, regardless of whether the merged branch has a version number or not, when this branch related property is set to true on the target branch.
-
-When `release-2.0.0` is merged into main, we want main to build `2.0.0`. If
-`release-2.0.0` is merged into develop we want it to build `2.1.0`, this option
-prevents incrementing after a versioned branch is merged.
-
-In a GitFlow-based repository, setting this option can have implications on the
-`VersionSourceDistance` output variable. It can rule out a potentially
-better version source proposed by the `MergeMessageBaseVersionStrategy`. For
-more details and an in-depth analysis, please see [the discussion][2506].
-
-### prevent-increment-when-branch-merged
-
-The increment of the merged branch will be ignored when this branch related property is set to `true` on the source branch.
-
-### prevent-increment-when-current-commit-tagged
-
-This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.
-
-### label-number-pattern
-
-Pull requests require us to extract the pre-release number out of the branch
-name so `refs/pull/534/merge` builds as `PullRequest534`. This is a regex with
-a named capture group called `Number`.
-
-**Example usage:**
-
-```yaml
-branches:
- pull-request:
- mode: ContinuousDelivery
- label: PullRequest{Number}
- increment: Inherit
- prevent-increment:
- of-merged-branch: true
- when-current-commit-tagged: false
- track-merge-message: true
- regex: ^(pull-requests|pull|pr)[\/-](?\d*)
- source-branches:
- - main
- - release
- - feature
- is-source-branch-for: []
- pre-release-weight: 30000
-```
-
-### track-merge-target
-
-Strategy which will look for tagged merge commits directly off the current
-branch. For example `develop` → `release/1.0.0` → merge into `main` and tag
-`1.0.0`. The tag is *not* on develop, but develop should be version `1.0.0` now.
-
-### track-merge-message
-
-This property is a branch related property and gives the user the possibility to control the behavior of whether the merge
-commit message will be interpreted as a next version or not. Consider we have a main branch and a `release/1.0.0` branch and
-merge changes from `release/1.0.0` to the `main` branch. If `track-merge-message` is set to `true` then the next version will
-be `1.0.0` otherwise `0.0.1`.
-
-### tracks-release-branches
-
-Indicates this branch config represents develop in GitFlow.
-
-### is-release-branch
-
-Indicates this branch config represents a release branch in GitFlow.
-
-### is-main-branch
-
-This indicates that this branch is a main branch. By default `main` and `support/*` are main branches.
-
-### pre-release-weight
-
-Provides a way to translate the `PreReleaseLabelName` ([variables][variables]) to a numeric
-value in order to avoid version collisions across different branches. For
-example, a release branch created after "1.2.3-alpha.55" results in
-"1.2.3-beta.1" and thus e.g. "1.2.3-alpha.4" and "1.2.3-beta.4" would have the
-same file version: "1.2.3.4". One of the ways to use this value is to set
-`assembly-file-versioning-format:
-{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}`. If the `pre-release-weight`
-is set, it would be added to the `PreReleaseNumber` to get a final
-`AssemblySemFileVer`, otherwise a branch specific default for
-`pre-release-weight` will be used in the calculation. Related Issues [1145][1145]
-and [1366][1366].
-
-### semantic-version-format
-
-Specifies the semantic version format that is used when parsing the string.
-Can be `Strict` - using the [regex](https://regex101.com/r/Ly7O1x/3/)
-or `Loose` the old way of parsing. The default if not specified is `Strict`
-Example of invalid `Strict`, but valid `Loose`
-
-```log
-1.2-alpha4
-01.02.03-rc03
-1.2.3.4
-```
-
-### strategies
-
-Specifies which version strategy implementation (one or more) will be used to determine the next version.
-These strategies can be combined, and the order in which they are specified does not matter.
-The configuration accepts the following values:
-
-* Fallback
-* ConfiguredNextVersion
-* MergeMessage
-* TaggedCommit
-* TrackReleaseBranches
-* VersionInBranchName
-* Mainline
-
-[1145]: https://github.com/GitTools/GitVersion/issues/1145
-
-[1366]: https://github.com/GitTools/GitVersion/issues/1366
+### version-bump-reset-message
-[2506]: https://github.com/GitTools/GitVersion/pull/2506#issuecomment-754754037
+The regex to match a commit message that resets the version bump baseline and
+suppresses the configured branch increment. The default is `=semver:`. The
+increment itself is still selected by the major, minor, patch, and no-bump
+message patterns above, whose defaults accept both `+semver` and `=semver`.
-[conventional-commits-config]: /docs/reference/version-increments#conventional-commit-messages
+For example, when a branch is configured with `increment: Patch`, a commit
+containing `=semver: none` keeps the current version and a commit containing
+`=semver: minor` selects a minor increment. Unlike the `+semver` form, the `=`
+form resets earlier commit-message increments in the calculation range and can
+lower the configured increment. This setting follows
+`commit-message-incrementing`.
-[conventional-commits]: https://www.conventionalcommits.org/
+### version-in-branch-pattern
-[modes]: /docs/reference/modes
+A regular expression which is used to determine the version number in the branch
+name or commit message (e.g., v1.0.0-LTS). This setting only applies on branches
+where the option `is-release-branch` is set to `true`. The default value is
+`(?[vV]?\d+(\.\d+)?(\.\d+)?).*`.
-[variables]: /docs/reference/variables
+### workflow
-[version-sources]: /docs/reference/version-sources
+The base template of the configuration to use. Possible values are `GitFlow/v1` or `GitHubFlow/v1`. Defaults to `GitFlow/v1` if not set. To create a configuration from scratch without using a base template, please specify an empty string.
diff --git a/docs/input/docs/workflows/GitFlow/v1.yml b/docs/input/docs/workflows/GitFlow/v1.yml
index d4cf3e6b8f..6d9dc6ae1a 100644
--- a/docs/input/docs/workflows/GitFlow/v1.yml
+++ b/docs/input/docs/workflows/GitFlow/v1.yml
@@ -1,95 +1,62 @@
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - Fallback
- - ConfiguredNextVersion
- - MergeMessage
- - TaggedCommit
- - TrackReleaseBranches
- - VersionInBranchName
+assembly-versioning-scheme: MajorMinorPatch
branches:
develop:
- mode: ContinuousDelivery
- label: alpha
increment: Minor
+ is-main-branch: false
+ is-release-branch: false
+ is-source-branch-for: []
+ label: alpha
+ mode: ContinuousDelivery
+ pre-release-weight: 0
prevent-increment:
when-current-commit-tagged: false
- track-merge-target: true
- track-merge-message: true
regex: ^dev(elop)?(ment)?$
source-branches:
- main
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: true
tracks-release-branches: true
- is-release-branch: false
- is-main-branch: false
- pre-release-weight: 0
main:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
release:
- mode: ManualDeployment
- label: beta
increment: Minor
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-target: false
regex: "^releases?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
feature:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- develop
@@ -97,17 +64,16 @@ branches:
- release
- support
- hotfix
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- develop
@@ -116,40 +82,41 @@ branches:
- feature
- support
- hotfix
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
hotfix:
- mode: ManualDeployment
- label: beta
increment: Inherit
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "^hotfix(es)?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
support:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
regex: "^support[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
unknown:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
prevent-increment:
when-current-commit-tagged: true
regex: "(?.+)"
@@ -161,8 +128,41 @@ branches:
- pull-request
- hotfix
- support
- is-source-branch-for: []
- is-main-branch: false
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - Fallback
+ - ConfiguredNextVersion
+ - MergeMessage
+ - TaggedCommit
+ - TrackReleaseBranches
+ - VersionInBranchName
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
diff --git a/docs/input/docs/workflows/GitHubFlow/v1.yml b/docs/input/docs/workflows/GitHubFlow/v1.yml
index 6f6c4eda22..b3d5d08601 100644
--- a/docs/input/docs/workflows/GitHubFlow/v1.yml
+++ b/docs/input/docs/workflows/GitHubFlow/v1.yml
@@ -1,117 +1,117 @@
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - Fallback
- - ConfiguredNextVersion
- - MergeMessage
- - TaggedCommit
- - TrackReleaseBranches
- - VersionInBranchName
+assembly-versioning-scheme: MajorMinorPatch
branches:
main:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
release:
- mode: ManualDeployment
- label: beta
increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-branch-merged: false
when-current-commit-tagged: false
- track-merge-target: false
- track-merge-message: true
regex: "^releases?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
feature:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- main
- release
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- main
- release
- feature
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
unknown:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: false
regex: "(?.+)"
source-branches:
- main
- release
- feature
- pull-request
- is-source-branch-for: []
- is-main-branch: false
+ track-merge-message: false
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - Fallback
+ - ConfiguredNextVersion
+ - MergeMessage
+ - TaggedCommit
+ - TrackReleaseBranches
+ - VersionInBranchName
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
diff --git a/docs/input/docs/workflows/TrunkBased/preview1.yml b/docs/input/docs/workflows/TrunkBased/preview1.yml
index d4704d32d7..fe8ebe9e39 100644
--- a/docs/input/docs/workflows/TrunkBased/preview1.yml
+++ b/docs/input/docs/workflows/TrunkBased/preview1.yml
@@ -1,102 +1,102 @@
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - ConfiguredNextVersion
- - Mainline
+assembly-versioning-scheme: MajorMinorPatch
branches:
main:
- mode: ContinuousDeployment
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ mode: ContinuousDeployment
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
feature:
- mode: ContinuousDelivery
- label: "{BranchName}"
increment: Minor
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
hotfix:
- mode: ContinuousDelivery
- label: "{BranchName}"
increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "^hotfix(es)?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- main
- feature
- hotfix
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
unknown:
increment: Patch
+ is-source-branch-for: []
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "(?.+)"
source-branches:
- main
- is-source-branch-for: []
- pre-release-weight: 30000
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - ConfiguredNextVersion
+ - Mainline
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
diff --git a/schemas/7.0/GitVersion.configuration.json b/schemas/7.0/GitVersion.configuration.json
index b283240341..e1e4dbcd98 100644
--- a/schemas/7.0/GitVersion.configuration.json
+++ b/schemas/7.0/GitVersion.configuration.json
@@ -73,15 +73,6 @@
"string"
]
},
- "mode": {
- "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.",
- "enum": [
- "ManualDeployment",
- "ContinuousDelivery",
- "ContinuousDeployment",
- null
- ]
- },
"increment": {
"description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.",
"$ref": "#/$defs/incrementStrategy"
@@ -111,6 +102,15 @@
"string"
]
},
+ "mode": {
+ "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.",
+ "enum": [
+ "ManualDeployment",
+ "ContinuousDelivery",
+ "ContinuousDeployment",
+ null
+ ]
+ },
"pre-release-weight": {
"description": "Provides a way to translate the PreReleaseLabelName to a number.",
"type": [
@@ -182,15 +182,6 @@
"string"
]
},
- "mode": {
- "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.",
- "enum": [
- "ManualDeployment",
- "ContinuousDelivery",
- "ContinuousDeployment",
- null
- ]
- },
"ignore": {
"description": "The header property for the ignore configuration.",
"type": "object",
@@ -267,6 +258,15 @@
"string"
]
},
+ "mode": {
+ "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.",
+ "enum": [
+ "ManualDeployment",
+ "ContinuousDelivery",
+ "ContinuousDeployment",
+ null
+ ]
+ },
"next-version": {
"description": "Allows you to bump the next version explicitly. Useful for bumping main or a feature branch with breaking changes",
"type": [
@@ -283,15 +283,6 @@
"string"
]
},
- "version-bump-reset-message": {
- "format": "regex",
- "description": "The regular expression to match commit messages that reset the version bump baseline and suppress the configured branch increment. Defaults to '=semver:'",
- "default": "=semver:",
- "type": [
- "null",
- "string"
- ]
- },
"patch-version-bump-message": {
"format": "regex",
"description": "The regular expression to match commit messages with to perform a patch version increment. Defaults to '[+=]semver:\\s?(fix|patch)'",
@@ -332,6 +323,29 @@
"description": "The source branches for this branch.",
"$ref": "#/$defs/hashSetOfString"
},
+ "strategies": {
+ "description": "Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfiguredNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'Mainline'.",
+ "type": "array",
+ "items": {
+ "enum": [
+ "None",
+ "Fallback",
+ "ConfiguredNextVersion",
+ "MergeMessage",
+ "TaggedCommit",
+ "TrackReleaseBranches",
+ "VersionInBranchName",
+ "Mainline"
+ ]
+ }
+ },
+ "tag-pre-release-weight": {
+ "description": "The pre-release weight in case of tagged commits. Defaults to 60000.",
+ "type": [
+ "null",
+ "integer"
+ ]
+ },
"tag-prefix": {
"format": "regex",
"description": "A regular expression which is used to trim Git tags before processing. Defaults to '[vV]?'",
@@ -341,13 +355,6 @@
"string"
]
},
- "tag-pre-release-weight": {
- "description": "The pre-release weight in case of tagged commits. Defaults to 60000.",
- "type": [
- "null",
- "integer"
- ]
- },
"track-merge-message": {
"description": "This property is a branch related property and gives the user the possibility to control the behavior of whether the merge commit message will be interpreted as a next version or not.",
"type": [
@@ -374,6 +381,15 @@
"default": "true",
"type": "boolean"
},
+ "version-bump-reset-message": {
+ "format": "regex",
+ "description": "The regular expression to match commit messages that reset the version bump baseline and suppress the configured branch increment. Defaults to '=semver:'",
+ "default": "=semver:",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
"version-in-branch-pattern": {
"format": "regex",
"description": "A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to '(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*'.",
@@ -383,22 +399,6 @@
"string"
]
},
- "strategies": {
- "description": "Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfiguredNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'Mainline'.",
- "type": "array",
- "items": {
- "enum": [
- "None",
- "Fallback",
- "ConfiguredNextVersion",
- "MergeMessage",
- "TaggedCommit",
- "TrackReleaseBranches",
- "VersionInBranchName",
- "Mainline"
- ]
- }
- },
"workflow": {
"description": "The base template of the configuration to use. Possible values are: 'GitFlow/v1' or 'GitHubFlow/v1'",
"type": [
@@ -450,4 +450,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt
index d4cf3e6b8f..6d9dc6ae1a 100644
--- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt
+++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt
@@ -1,95 +1,62 @@
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - Fallback
- - ConfiguredNextVersion
- - MergeMessage
- - TaggedCommit
- - TrackReleaseBranches
- - VersionInBranchName
+assembly-versioning-scheme: MajorMinorPatch
branches:
develop:
- mode: ContinuousDelivery
- label: alpha
increment: Minor
+ is-main-branch: false
+ is-release-branch: false
+ is-source-branch-for: []
+ label: alpha
+ mode: ContinuousDelivery
+ pre-release-weight: 0
prevent-increment:
when-current-commit-tagged: false
- track-merge-target: true
- track-merge-message: true
regex: ^dev(elop)?(ment)?$
source-branches:
- main
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: true
tracks-release-branches: true
- is-release-branch: false
- is-main-branch: false
- pre-release-weight: 0
main:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
release:
- mode: ManualDeployment
- label: beta
increment: Minor
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-target: false
regex: "^releases?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
feature:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- develop
@@ -97,17 +64,16 @@ branches:
- release
- support
- hotfix
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- develop
@@ -116,40 +82,41 @@ branches:
- feature
- support
- hotfix
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
hotfix:
- mode: ManualDeployment
- label: beta
increment: Inherit
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "^hotfix(es)?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
support:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
regex: "^support[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
unknown:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
prevent-increment:
when-current-commit-tagged: true
regex: "(?.+)"
@@ -161,8 +128,41 @@ branches:
- pull-request
- hotfix
- support
- is-source-branch-for: []
- is-main-branch: false
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - Fallback
+ - ConfiguredNextVersion
+ - MergeMessage
+ - TaggedCommit
+ - TrackReleaseBranches
+ - VersionInBranchName
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationSerializerTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationSerializerTests.cs
new file mode 100644
index 0000000000..433985659b
--- /dev/null
+++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationSerializerTests.cs
@@ -0,0 +1,44 @@
+using GitVersion.VersionCalculation;
+
+namespace GitVersion.Configuration.Tests;
+
+[TestFixture]
+public class ConfigurationSerializerTests
+{
+ private readonly ConfigurationSerializer serializer = new();
+
+ [Test]
+ public void Serialize_OrdersConfigurationPropertiesAndPreservesBranchNames()
+ {
+ var configuration = new GitVersionConfiguration
+ {
+ Branches = new Dictionary
+ {
+ ["z-last"] = new() { Label = "z", Increment = IncrementStrategy.Minor },
+ ["a-first"] = new() { Label = "a", Increment = IncrementStrategy.Major }
+ }
+ };
+
+ var yaml = this.serializer.Serialize(configuration);
+ var lines = yaml.Split('\n', StringSplitOptions.RemoveEmptyEntries);
+ var rootPropertyNames = lines
+ .Where(line => !char.IsWhiteSpace(line[0]))
+ .Select(GetPropertyName)
+ .ToArray();
+
+ rootPropertyNames.ShouldBe(rootPropertyNames.Order(StringComparer.Ordinal));
+ yaml.IndexOf(" z-last:", StringComparison.Ordinal)
+ .ShouldBeLessThan(yaml.IndexOf(" a-first:", StringComparison.Ordinal));
+
+ var firstBranchProperties = lines
+ .SkipWhile(line => line != " z-last:")
+ .Skip(1)
+ .TakeWhile(line => line.StartsWith(" ", StringComparison.Ordinal))
+ .Select(GetPropertyName)
+ .ToArray();
+
+ firstBranchProperties.ShouldBe(firstBranchProperties.Order(StringComparer.Ordinal));
+ }
+
+ private static string GetPropertyName(string line) => line.TrimStart().Split(':', 2)[0];
+}
diff --git a/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs b/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs
index 5de8606187..f5782f7a9f 100644
--- a/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs
+++ b/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs
@@ -16,17 +16,17 @@ public void CanDeserialize()
const string yaml =
"""
ignore:
- sha: [b6c0c9fda88830ebcd563e500a5a7da5a1658e98]
commits-before: 2015-10-23T12:23:15
+ sha: [b6c0c9fda88830ebcd563e500a5a7da5a1658e98]
""";
var configuration = this.serializer.ReadConfiguration(yaml);
configuration.ShouldNotBeNull();
configuration.Ignore.ShouldNotBeNull();
+ configuration.Ignore.Before.ShouldBe(DateTimeOffset.Parse("2015-10-23T12:23:15", CultureInfo.InvariantCulture));
configuration.Ignore.Shas.ShouldNotBeEmpty();
configuration.Ignore.Shas.ShouldBe(["b6c0c9fda88830ebcd563e500a5a7da5a1658e98"]);
- configuration.Ignore.Before.ShouldBe(DateTimeOffset.Parse("2015-10-23T12:23:15", CultureInfo.InvariantCulture));
}
[Test]
@@ -57,8 +57,9 @@ public void WhenNotInConfigShouldHaveDefaults()
configuration.ShouldNotBeNull();
configuration.Ignore.ShouldNotBeNull();
- configuration.Ignore.Shas.ShouldBeEmpty();
configuration.Ignore.Before.ShouldBe(null);
+ configuration.Ignore.Paths.ShouldBeEmpty();
+ configuration.Ignore.Shas.ShouldBeEmpty();
}
[Test]
diff --git a/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml b/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml
index d4cf3e6b8f..6d9dc6ae1a 100644
--- a/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml
+++ b/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml
@@ -1,95 +1,62 @@
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - Fallback
- - ConfiguredNextVersion
- - MergeMessage
- - TaggedCommit
- - TrackReleaseBranches
- - VersionInBranchName
+assembly-versioning-scheme: MajorMinorPatch
branches:
develop:
- mode: ContinuousDelivery
- label: alpha
increment: Minor
+ is-main-branch: false
+ is-release-branch: false
+ is-source-branch-for: []
+ label: alpha
+ mode: ContinuousDelivery
+ pre-release-weight: 0
prevent-increment:
when-current-commit-tagged: false
- track-merge-target: true
- track-merge-message: true
regex: ^dev(elop)?(ment)?$
source-branches:
- main
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: true
tracks-release-branches: true
- is-release-branch: false
- is-main-branch: false
- pre-release-weight: 0
main:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
release:
- mode: ManualDeployment
- label: beta
increment: Minor
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-target: false
regex: "^releases?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
feature:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- develop
@@ -97,17 +64,16 @@ branches:
- release
- support
- hotfix
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- develop
@@ -116,40 +82,41 @@ branches:
- feature
- support
- hotfix
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
hotfix:
- mode: ManualDeployment
- label: beta
increment: Inherit
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "^hotfix(es)?[\\/-](?.+)"
source-branches:
- main
- support
- is-source-branch-for: []
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
support:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
regex: "^support[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
unknown:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
prevent-increment:
when-current-commit-tagged: true
regex: "(?.+)"
@@ -161,8 +128,41 @@ branches:
- pull-request
- hotfix
- support
- is-source-branch-for: []
- is-main-branch: false
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - Fallback
+ - ConfiguredNextVersion
+ - MergeMessage
+ - TaggedCommit
+ - TrackReleaseBranches
+ - VersionInBranchName
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
diff --git a/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml b/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml
index 6f6c4eda22..b3d5d08601 100644
--- a/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml
+++ b/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml
@@ -1,117 +1,117 @@
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - Fallback
- - ConfiguredNextVersion
- - MergeMessage
- - TaggedCommit
- - TrackReleaseBranches
- - VersionInBranchName
+assembly-versioning-scheme: MajorMinorPatch
branches:
main:
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
release:
- mode: ManualDeployment
- label: beta
increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-branch-merged: false
when-current-commit-tagged: false
- track-merge-target: false
- track-merge-message: true
regex: "^releases?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
feature:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- main
- release
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- main
- release
- feature
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
unknown:
- mode: ManualDeployment
- label: "{BranchName}"
increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: false
regex: "(?.+)"
source-branches:
- main
- release
- feature
- pull-request
- is-source-branch-for: []
- is-main-branch: false
+ track-merge-message: false
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - Fallback
+ - ConfiguredNextVersion
+ - MergeMessage
+ - TaggedCommit
+ - TrackReleaseBranches
+ - VersionInBranchName
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
diff --git a/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml b/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml
index d4704d32d7..fe8ebe9e39 100644
--- a/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml
+++ b/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml
@@ -1,102 +1,102 @@
-mode: ContinuousDelivery
-label: "{BranchName}"
-increment: Inherit
-prevent-increment:
- of-merged-branch: false
- when-branch-merged: false
- when-current-commit-tagged: true
-track-merge-target: false
-track-merge-message: true
-commit-message-incrementing: Enabled
-regex: ''
-source-branches: []
-is-source-branch-for: []
-tracks-release-branches: false
-is-release-branch: false
-is-main-branch: false
-assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
-tag-prefix: "[vV]?"
-version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
-major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
-minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
-patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
-no-bump-message: "[+=]semver:\\s?(none|skip)"
-version-bump-reset-message: "=semver:"
-tag-pre-release-weight: 60000
-commit-date-format: yyyy-MM-dd
-merge-message-formats: {}
-update-build-number: true
-semantic-version-format: Strict
-strategies:
- - ConfiguredNextVersion
- - Mainline
+assembly-versioning-scheme: MajorMinorPatch
branches:
main:
- mode: ContinuousDeployment
- label: ''
increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ mode: ContinuousDeployment
+ pre-release-weight: 55000
prevent-increment:
of-merged-branch: true
- track-merge-target: false
- track-merge-message: true
regex: "^master$|^main$"
source-branches: []
- is-source-branch-for: []
+ track-merge-message: true
+ track-merge-target: false
tracks-release-branches: false
- is-release-branch: false
- is-main-branch: true
- pre-release-weight: 55000
feature:
- mode: ContinuousDelivery
- label: "{BranchName}"
increment: Minor
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
- track-merge-message: true
regex: "^features?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
- is-main-branch: false
- pre-release-weight: 30000
+ track-merge-message: true
hotfix:
- mode: ContinuousDelivery
- label: "{BranchName}"
increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "^hotfix(es)?[\\/-](?.+)"
source-branches:
- main
- is-source-branch-for: []
- is-release-branch: true
- is-main-branch: false
- pre-release-weight: 30000
pull-request:
- mode: ContinuousDelivery
- label: "PullRequest{Number}"
increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ pre-release-weight: 30000
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
- track-merge-message: true
regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
source-branches:
- main
- feature
- hotfix
- is-source-branch-for: []
- pre-release-weight: 30000
+ track-merge-message: true
unknown:
increment: Patch
+ is-source-branch-for: []
+ pre-release-weight: 30000
prevent-increment:
when-current-commit-tagged: false
regex: "(?.+)"
source-branches:
- main
- is-source-branch-for: []
- pre-release-weight: 30000
+commit-date-format: yyyy-MM-dd
+commit-message-incrementing: Enabled
ignore:
- sha: []
paths: []
+ sha: []
+increment: Inherit
+is-main-branch: false
+is-release-branch: false
+is-source-branch-for: []
+label: "{BranchName}"
+major-version-bump-message: "[+=]semver:\\s?(breaking|major)"
+merge-message-formats: {}
+minor-version-bump-message: "[+=]semver:\\s?(feature|minor)"
+mode: ContinuousDelivery
+no-bump-message: "[+=]semver:\\s?(none|skip)"
+patch-version-bump-message: "[+=]semver:\\s?(fix|patch)"
+prevent-increment:
+ of-merged-branch: false
+ when-branch-merged: false
+ when-current-commit-tagged: true
+regex: ''
+semantic-version-format: Strict
+source-branches: []
+strategies:
+ - ConfiguredNextVersion
+ - Mainline
+tag-pre-release-weight: 60000
+tag-prefix: "[vV]?"
+track-merge-message: true
+track-merge-target: false
+tracks-release-branches: false
+update-build-number: true
+version-bump-reset-message: "=semver:"
+version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
diff --git a/src/GitVersion.Configuration/ConfigurationSerializer.cs b/src/GitVersion.Configuration/ConfigurationSerializer.cs
index 3f0c58e9b3..9138e1fce7 100644
--- a/src/GitVersion.Configuration/ConfigurationSerializer.cs
+++ b/src/GitVersion.Configuration/ConfigurationSerializer.cs
@@ -4,6 +4,12 @@ namespace GitVersion.Configuration;
internal class ConfigurationSerializer : IConfigurationSerializer
{
+ private static readonly HashSet PreserveKeyOrderFor =
+ [
+ "branches",
+ "merge-message-formats"
+ ];
+
private static readonly ConfigurationYamlContext GeneratedContext = ConfigurationYamlContext.Default;
private static readonly YamlSerializerOptions SerializerOptions = new()
@@ -37,7 +43,11 @@ public T Deserialize(string input)
}
public string Serialize(object graph)
- => YamlSerializer.Serialize(graph, SerializerOptions);
+ {
+ var yaml = YamlSerializer.Serialize(graph, SerializerOptions);
+ var configuration = YamlSerializer.Deserialize>(yaml, SerializerOptions) ?? [];
+ return YamlSerializer.Serialize(OrderProperties(configuration), SerializerOptions);
+ }
public IGitVersionConfiguration? ReadConfiguration(string input) => Deserialize(input);
@@ -76,6 +86,31 @@ public string Serialize(object graph)
return result;
}
+ private static Dictionary OrderProperties(
+ IReadOnlyDictionary source,
+ bool orderKeys = true)
+ {
+ IEnumerable> entries = orderKeys
+ ? source.OrderBy(element => element.Key, StringComparer.Ordinal)
+ : source;
+ Dictionary result = [];
+
+ foreach (var (key, value) in entries)
+ {
+ result[key] = OrderValue(value, orderKeys: !PreserveKeyOrderFor.Contains(key));
+ }
+
+ return result;
+ }
+
+ private static object? OrderValue(object? value, bool orderKeys) => value switch
+ {
+ IReadOnlyDictionary dictionary => OrderProperties(dictionary, orderKeys),
+ IDictionary dictionary => OrderProperties(new Dictionary(dictionary), orderKeys),
+ IList list => list.Cast