diff --git a/.github/actions/cache-restore/action.yml b/.github/actions/cache-restore/action.yml
index 153f2d15f0..ae5e9f409e 100644
--- a/.github/actions/cache-restore/action.yml
+++ b/.github/actions/cache-restore/action.yml
@@ -16,7 +16,7 @@ runs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: tools
- key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
+ key: tools-${{ runner.os }}-${{ hashFiles('./build/**', './.gitversion.yml') }}
- name: Cache NuGet packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
diff --git a/.github/workflows/_prepare.yml b/.github/workflows/_prepare.yml
index 0fc2528e34..3059ff75d6 100644
--- a/.github/workflows/_prepare.yml
+++ b/.github/workflows/_prepare.yml
@@ -42,7 +42,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: tools
- key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
+ key: tools-${{ runner.os }}-${{ hashFiles('./build/**', './.gitversion.yml') }}
- name: Cache NuGet packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index cb7eaeb577..6e19867296 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -60,7 +60,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: tools
- key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
+ key: tools-${{ runner.os }}-${{ hashFiles('./build/**', './.gitversion.yml') }}
- name: Setup .NET SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
diff --git a/.gitversion.yml b/.gitversion.yml
index 7f3e82a62b..a57118c2e5 100644
--- a/.gitversion.yml
+++ b/.gitversion.yml
@@ -1,9 +1,11 @@
# $schema: https://gitversion.net/schemas/7.0/GitVersion.configuration.json
-workflow: GitFlow/v1
-mode: ManualDeployment
-next-version: 7.0.0
-branches:
- main:
- label: alpha
- support:
- label: beta
+calculation:
+ workflow: GitFlow/v1
+ mode: ManualDeployment
+ next-version: 7.0.0
+ branches:
+ main:
+ label: alpha
+ support:
+ label: beta
+output: {}
diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md
index 0015f1e1b6..427ec535b4 100644
--- a/docs/input/docs/reference/configuration.md
+++ b/docs/input/docs/reference/configuration.md
@@ -32,8 +32,9 @@ The following supported workflow configurations are available in GitVersion and
Example of using a `GitHubFlow` workflow with a different `tag-prefix`:
```yaml
-workflow: GitHubFlow/v1
-tag-prefix: '[abc]'
+calculation:
+ workflow: GitHubFlow/v1
+ tag-prefix: '[abc]'
```
The built-in configuration for the `GitFlow` workflow (`workflow: GitFlow/v1`) looks like:
@@ -41,178 +42,188 @@ The built-in configuration for the `GitFlow` workflow (`workflow: GitFlow/v1`) l
```yml
-assembly-file-versioning-scheme: MajorMinorPatch
-assembly-versioning-scheme: MajorMinorPatch
-branches:
- develop:
- 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
- regex: ^dev(elop)?(ment)?$
- source-branches:
- - main
- track-merge-message: true
- track-merge-target: true
- tracks-release-branches: true
- main:
- 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
- regex: "^master$|^main$"
- source-branches: []
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- release:
- 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
- regex: "^releases?[\\/-](?.+)"
- source-branches:
- - main
- - support
- track-merge-target: false
- tracks-release-branches: false
- feature:
- 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
- regex: "^features?[\\/-](?.+)"
- source-branches:
- - develop
- - main
- - release
- - support
- - hotfix
- track-merge-message: true
- pull-request:
- 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
- regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
- source-branches:
- - develop
- - main
- - release
- - feature
- - support
- - hotfix
- track-merge-message: true
- hotfix:
- 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
- support:
- 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
- regex: "^support[\\/-](?.+)"
- source-branches:
- - main
- track-merge-target: false
- tracks-release-branches: false
- unknown:
- increment: Inherit
- is-main-branch: false
- is-source-branch-for: []
- label: "{BranchName}"
- mode: ManualDeployment
- prevent-increment:
- when-current-commit-tagged: true
- regex: "(?.+)"
- source-branches:
- - main
- - develop
- - release
- - feature
- - pull-request
- - hotfix
- - support
-commit-date-format: yyyy-MM-dd
-commit-message-incrementing: Enabled
-ignore:
- branches: []
- paths: []
- sha: []
- tags: []
-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+)?).*"
+calculation:
+ branches:
+ develop:
+ increment: Minor
+ is-main-branch: false
+ is-release-branch: false
+ is-source-branch-for: []
+ label: alpha
+ mode: ContinuousDelivery
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: ^dev(elop)?(ment)?$
+ source-branches:
+ - main
+ track-merge-message: true
+ track-merge-target: true
+ tracks-release-branches: true
+ main:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^master$|^main$"
+ source-branches: []
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ release:
+ increment: Minor
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^releases?[\\/-](?.+)"
+ source-branches:
+ - main
+ - support
+ track-merge-target: false
+ tracks-release-branches: false
+ feature:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^features?[\\/-](?.+)"
+ source-branches:
+ - develop
+ - main
+ - release
+ - support
+ - hotfix
+ track-merge-message: true
+ pull-request:
+ increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
+ source-branches:
+ - develop
+ - main
+ - release
+ - feature
+ - support
+ - hotfix
+ track-merge-message: true
+ hotfix:
+ increment: Inherit
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^hotfix(es)?[\\/-](?.+)"
+ source-branches:
+ - main
+ - support
+ support:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^support[\\/-](?.+)"
+ source-branches:
+ - main
+ track-merge-target: false
+ tracks-release-branches: false
+ unknown:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: true
+ regex: "(?.+)"
+ source-branches:
+ - main
+ - develop
+ - release
+ - feature
+ - pull-request
+ - hotfix
+ - support
+ commit-message-incrementing: Enabled
+ ignore:
+ branches: []
+ paths: []
+ sha: []
+ tags: []
+ 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-prefix: "[vV]?"
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ version-bump-reset-message: "=semver:"
+ version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
+output:
+ assembly-file-versioning-scheme: MajorMinorPatch
+ assembly-versioning-scheme: MajorMinorPatch
+ branches:
+ develop:
+ pre-release-weight: 0
+ main:
+ pre-release-weight: 55000
+ release:
+ pre-release-weight: 30000
+ feature:
+ pre-release-weight: 30000
+ pull-request:
+ pre-release-weight: 30000
+ hotfix:
+ pre-release-weight: 30000
+ support:
+ pre-release-weight: 55000
+ commit-date-format: yyyy-MM-dd
+ tag-pre-release-weight: 60000
+ update-build-number: true
```
-snippet source | anchor
+snippet source | anchor
The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
@@ -220,127 +231,134 @@ The supported built-in configuration for the `GitHubFlow` workflow (`workflow: G
```yml
-assembly-file-versioning-scheme: MajorMinorPatch
-assembly-versioning-scheme: MajorMinorPatch
-branches:
- main:
- 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
- regex: "^master$|^main$"
- source-branches: []
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- release:
- 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
- regex: "^releases?[\\/-](?.+)"
- source-branches:
- - main
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- feature:
- 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
- regex: "^features?[\\/-](?.+)"
- source-branches:
- - main
- - release
- track-merge-message: true
- pull-request:
- 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
- regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
- source-branches:
- - main
- - release
- - feature
- track-merge-message: true
- unknown:
- increment: Inherit
- is-main-branch: false
- is-source-branch-for: []
- label: "{BranchName}"
- mode: ManualDeployment
- prevent-increment:
- when-current-commit-tagged: false
- regex: "(?.+)"
- source-branches:
- - main
- - release
- - feature
- - pull-request
- track-merge-message: false
-commit-date-format: yyyy-MM-dd
-commit-message-incrementing: Enabled
-ignore:
- branches: []
- paths: []
- sha: []
- tags: []
-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+)?).*"
+calculation:
+ branches:
+ main:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^master$|^main$"
+ source-branches: []
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ release:
+ increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ prevent-increment:
+ of-merged-branch: true
+ when-branch-merged: false
+ when-current-commit-tagged: false
+ regex: "^releases?[\\/-](?.+)"
+ source-branches:
+ - main
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ feature:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^features?[\\/-](?.+)"
+ source-branches:
+ - main
+ - release
+ track-merge-message: true
+ pull-request:
+ increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
+ source-branches:
+ - main
+ - release
+ - feature
+ track-merge-message: true
+ unknown:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "(?.+)"
+ source-branches:
+ - main
+ - release
+ - feature
+ - pull-request
+ track-merge-message: false
+ commit-message-incrementing: Enabled
+ ignore:
+ branches: []
+ paths: []
+ sha: []
+ tags: []
+ 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-prefix: "[vV]?"
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ version-bump-reset-message: "=semver:"
+ version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
+output:
+ assembly-file-versioning-scheme: MajorMinorPatch
+ assembly-versioning-scheme: MajorMinorPatch
+ branches:
+ main:
+ pre-release-weight: 55000
+ release:
+ pre-release-weight: 30000
+ feature:
+ pre-release-weight: 30000
+ pull-request:
+ pre-release-weight: 30000
+ commit-date-format: yyyy-MM-dd
+ tag-pre-release-weight: 60000
+ update-build-number: true
```
-snippet source | anchor
+snippet source | anchor
The preview built-in configuration (experimental usage only) for the `TrunkBased` workflow (`workflow: TrunkBased/preview1`) looks like:
@@ -348,112 +366,120 @@ The preview built-in configuration (experimental usage only) for the `TrunkBased
```yml
-assembly-file-versioning-scheme: MajorMinorPatch
-assembly-versioning-scheme: MajorMinorPatch
-branches:
- main:
- 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
- regex: "^master$|^main$"
- source-branches: []
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- feature:
- 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
- regex: "^features?[\\/-](?.+)"
- source-branches:
- - main
- track-merge-message: true
- hotfix:
- 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
- pull-request:
- 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
- regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
- source-branches:
- - main
- - feature
- - hotfix
- 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
-commit-date-format: yyyy-MM-dd
-commit-message-incrementing: Enabled
-ignore:
- branches: []
- paths: []
- sha: []
- tags: []
-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+)?).*"
+calculation:
+ branches:
+ main:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ mode: ContinuousDeployment
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^master$|^main$"
+ source-branches: []
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ feature:
+ increment: Minor
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^features?[\\/-](?.+)"
+ source-branches:
+ - main
+ track-merge-message: true
+ hotfix:
+ increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^hotfix(es)?[\\/-](?.+)"
+ source-branches:
+ - main
+ pull-request:
+ increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
+ source-branches:
+ - main
+ - feature
+ - hotfix
+ track-merge-message: true
+ unknown:
+ increment: Patch
+ is-source-branch-for: []
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "(?.+)"
+ source-branches:
+ - main
+ commit-message-incrementing: Enabled
+ ignore:
+ branches: []
+ paths: []
+ sha: []
+ tags: []
+ 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-prefix: "[vV]?"
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ version-bump-reset-message: "=semver:"
+ version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
+output:
+ assembly-file-versioning-scheme: MajorMinorPatch
+ assembly-versioning-scheme: MajorMinorPatch
+ branches:
+ main:
+ pre-release-weight: 55000
+ feature:
+ pre-release-weight: 30000
+ hotfix:
+ pre-release-weight: 30000
+ pull-request:
+ pre-release-weight: 30000
+ unknown:
+ pre-release-weight: 30000
+ commit-date-format: yyyy-MM-dd
+ tag-pre-release-weight: 60000
+ update-build-number: true
```
-snippet source | anchor
+snippet source | anchor
The details of the available options are as follows:
diff --git a/docs/input/docs/reference/mdsource/configuration.source.md b/docs/input/docs/reference/mdsource/configuration.source.md
index 42454a39f1..18d6fe52b9 100644
--- a/docs/input/docs/reference/mdsource/configuration.source.md
+++ b/docs/input/docs/reference/mdsource/configuration.source.md
@@ -32,8 +32,9 @@ The following supported workflow configurations are available in GitVersion and
Example of using a `GitHubFlow` workflow with a different `tag-prefix`:
```yaml
-workflow: GitHubFlow/v1
-tag-prefix: '[abc]'
+calculation:
+ workflow: GitHubFlow/v1
+ tag-prefix: '[abc]'
```
The built-in configuration for the `GitFlow` workflow (`workflow: GitFlow/v1`) looks like:
diff --git a/docs/input/docs/workflows/GitFlow/v1.yml b/docs/input/docs/workflows/GitFlow/v1.yml
index cb02dab624..eb3ec5ba8a 100644
--- a/docs/input/docs/workflows/GitFlow/v1.yml
+++ b/docs/input/docs/workflows/GitFlow/v1.yml
@@ -1,170 +1,180 @@
-assembly-file-versioning-scheme: MajorMinorPatch
-assembly-versioning-scheme: MajorMinorPatch
-branches:
- develop:
- 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
- regex: ^dev(elop)?(ment)?$
- source-branches:
- - main
- track-merge-message: true
- track-merge-target: true
- tracks-release-branches: true
- main:
- 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
- regex: "^master$|^main$"
- source-branches: []
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- release:
- 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
- regex: "^releases?[\\/-](?.+)"
- source-branches:
- - main
- - support
- track-merge-target: false
- tracks-release-branches: false
- feature:
- 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
- regex: "^features?[\\/-](?.+)"
- source-branches:
- - develop
- - main
- - release
- - support
- - hotfix
- track-merge-message: true
- pull-request:
- 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
- regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
- source-branches:
- - develop
- - main
- - release
- - feature
- - support
- - hotfix
- track-merge-message: true
- hotfix:
- 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
- support:
- 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
- regex: "^support[\\/-](?.+)"
- source-branches:
- - main
- track-merge-target: false
- tracks-release-branches: false
- unknown:
- increment: Inherit
- is-main-branch: false
- is-source-branch-for: []
- label: "{BranchName}"
- mode: ManualDeployment
- prevent-increment:
- when-current-commit-tagged: true
- regex: "(?.+)"
- source-branches:
- - main
- - develop
- - release
- - feature
- - pull-request
- - hotfix
- - support
-commit-date-format: yyyy-MM-dd
-commit-message-incrementing: Enabled
-ignore:
- branches: []
- paths: []
- sha: []
- tags: []
-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+)?).*"
+calculation:
+ branches:
+ develop:
+ increment: Minor
+ is-main-branch: false
+ is-release-branch: false
+ is-source-branch-for: []
+ label: alpha
+ mode: ContinuousDelivery
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: ^dev(elop)?(ment)?$
+ source-branches:
+ - main
+ track-merge-message: true
+ track-merge-target: true
+ tracks-release-branches: true
+ main:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^master$|^main$"
+ source-branches: []
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ release:
+ increment: Minor
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^releases?[\\/-](?.+)"
+ source-branches:
+ - main
+ - support
+ track-merge-target: false
+ tracks-release-branches: false
+ feature:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^features?[\\/-](?.+)"
+ source-branches:
+ - develop
+ - main
+ - release
+ - support
+ - hotfix
+ track-merge-message: true
+ pull-request:
+ increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
+ source-branches:
+ - develop
+ - main
+ - release
+ - feature
+ - support
+ - hotfix
+ track-merge-message: true
+ hotfix:
+ increment: Inherit
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^hotfix(es)?[\\/-](?.+)"
+ source-branches:
+ - main
+ - support
+ support:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^support[\\/-](?.+)"
+ source-branches:
+ - main
+ track-merge-target: false
+ tracks-release-branches: false
+ unknown:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: true
+ regex: "(?.+)"
+ source-branches:
+ - main
+ - develop
+ - release
+ - feature
+ - pull-request
+ - hotfix
+ - support
+ commit-message-incrementing: Enabled
+ ignore:
+ branches: []
+ paths: []
+ sha: []
+ tags: []
+ 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-prefix: "[vV]?"
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ version-bump-reset-message: "=semver:"
+ version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
+output:
+ assembly-file-versioning-scheme: MajorMinorPatch
+ assembly-versioning-scheme: MajorMinorPatch
+ branches:
+ develop:
+ pre-release-weight: 0
+ main:
+ pre-release-weight: 55000
+ release:
+ pre-release-weight: 30000
+ feature:
+ pre-release-weight: 30000
+ pull-request:
+ pre-release-weight: 30000
+ hotfix:
+ pre-release-weight: 30000
+ support:
+ pre-release-weight: 55000
+ commit-date-format: yyyy-MM-dd
+ tag-pre-release-weight: 60000
+ update-build-number: true
diff --git a/docs/input/docs/workflows/GitHubFlow/v1.yml b/docs/input/docs/workflows/GitHubFlow/v1.yml
index 70e3a4d8bf..0e1d664674 100644
--- a/docs/input/docs/workflows/GitHubFlow/v1.yml
+++ b/docs/input/docs/workflows/GitHubFlow/v1.yml
@@ -1,119 +1,126 @@
-assembly-file-versioning-scheme: MajorMinorPatch
-assembly-versioning-scheme: MajorMinorPatch
-branches:
- main:
- 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
- regex: "^master$|^main$"
- source-branches: []
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- release:
- 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
- regex: "^releases?[\\/-](?.+)"
- source-branches:
- - main
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- feature:
- 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
- regex: "^features?[\\/-](?.+)"
- source-branches:
- - main
- - release
- track-merge-message: true
- pull-request:
- 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
- regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
- source-branches:
- - main
- - release
- - feature
- track-merge-message: true
- unknown:
- increment: Inherit
- is-main-branch: false
- is-source-branch-for: []
- label: "{BranchName}"
- mode: ManualDeployment
- prevent-increment:
- when-current-commit-tagged: false
- regex: "(?.+)"
- source-branches:
- - main
- - release
- - feature
- - pull-request
- track-merge-message: false
-commit-date-format: yyyy-MM-dd
-commit-message-incrementing: Enabled
-ignore:
- branches: []
- paths: []
- sha: []
- tags: []
-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+)?).*"
+calculation:
+ branches:
+ main:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^master$|^main$"
+ source-branches: []
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ release:
+ increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: beta
+ mode: ManualDeployment
+ prevent-increment:
+ of-merged-branch: true
+ when-branch-merged: false
+ when-current-commit-tagged: false
+ regex: "^releases?[\\/-](?.+)"
+ source-branches:
+ - main
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ feature:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^features?[\\/-](?.+)"
+ source-branches:
+ - main
+ - release
+ track-merge-message: true
+ pull-request:
+ increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
+ source-branches:
+ - main
+ - release
+ - feature
+ track-merge-message: true
+ unknown:
+ increment: Inherit
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ManualDeployment
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "(?.+)"
+ source-branches:
+ - main
+ - release
+ - feature
+ - pull-request
+ track-merge-message: false
+ commit-message-incrementing: Enabled
+ ignore:
+ branches: []
+ paths: []
+ sha: []
+ tags: []
+ 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-prefix: "[vV]?"
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ version-bump-reset-message: "=semver:"
+ version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
+output:
+ assembly-file-versioning-scheme: MajorMinorPatch
+ assembly-versioning-scheme: MajorMinorPatch
+ branches:
+ main:
+ pre-release-weight: 55000
+ release:
+ pre-release-weight: 30000
+ feature:
+ pre-release-weight: 30000
+ pull-request:
+ pre-release-weight: 30000
+ commit-date-format: yyyy-MM-dd
+ tag-pre-release-weight: 60000
+ update-build-number: true
diff --git a/docs/input/docs/workflows/TrunkBased/preview1.yml b/docs/input/docs/workflows/TrunkBased/preview1.yml
index 2998ca1498..85b8f4d372 100644
--- a/docs/input/docs/workflows/TrunkBased/preview1.yml
+++ b/docs/input/docs/workflows/TrunkBased/preview1.yml
@@ -1,104 +1,112 @@
-assembly-file-versioning-scheme: MajorMinorPatch
-assembly-versioning-scheme: MajorMinorPatch
-branches:
- main:
- 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
- regex: "^master$|^main$"
- source-branches: []
- track-merge-message: true
- track-merge-target: false
- tracks-release-branches: false
- feature:
- 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
- regex: "^features?[\\/-](?.+)"
- source-branches:
- - main
- track-merge-message: true
- hotfix:
- 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
- pull-request:
- 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
- regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
- source-branches:
- - main
- - feature
- - hotfix
- 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
-commit-date-format: yyyy-MM-dd
-commit-message-incrementing: Enabled
-ignore:
- branches: []
- paths: []
- sha: []
- tags: []
-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+)?).*"
+calculation:
+ branches:
+ main:
+ increment: Patch
+ is-main-branch: true
+ is-release-branch: false
+ is-source-branch-for: []
+ label: ''
+ mode: ContinuousDeployment
+ prevent-increment:
+ of-merged-branch: true
+ regex: "^master$|^main$"
+ source-branches: []
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ feature:
+ increment: Minor
+ is-main-branch: false
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^features?[\\/-](?.+)"
+ source-branches:
+ - main
+ track-merge-message: true
+ hotfix:
+ increment: Patch
+ is-main-branch: false
+ is-release-branch: true
+ is-source-branch-for: []
+ label: "{BranchName}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "^hotfix(es)?[\\/-](?.+)"
+ source-branches:
+ - main
+ pull-request:
+ increment: Inherit
+ is-source-branch-for: []
+ label: "PullRequest{Number}"
+ mode: ContinuousDelivery
+ prevent-increment:
+ of-merged-branch: true
+ when-current-commit-tagged: false
+ regex: "^(pull-requests|pull|pr)[\\/-](?\\d*)"
+ source-branches:
+ - main
+ - feature
+ - hotfix
+ track-merge-message: true
+ unknown:
+ increment: Patch
+ is-source-branch-for: []
+ prevent-increment:
+ when-current-commit-tagged: false
+ regex: "(?.+)"
+ source-branches:
+ - main
+ commit-message-incrementing: Enabled
+ ignore:
+ branches: []
+ paths: []
+ sha: []
+ tags: []
+ 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-prefix: "[vV]?"
+ track-merge-message: true
+ track-merge-target: false
+ tracks-release-branches: false
+ version-bump-reset-message: "=semver:"
+ version-in-branch-pattern: "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
+output:
+ assembly-file-versioning-scheme: MajorMinorPatch
+ assembly-versioning-scheme: MajorMinorPatch
+ branches:
+ main:
+ pre-release-weight: 55000
+ feature:
+ pre-release-weight: 30000
+ hotfix:
+ pre-release-weight: 30000
+ pull-request:
+ pre-release-weight: 30000
+ unknown:
+ pre-release-weight: 30000
+ commit-date-format: yyyy-MM-dd
+ tag-pre-release-weight: 60000
+ update-build-number: true
diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs
index 2b9bd12c8f..66185de591 100644
--- a/src/GitVersion.App.Tests/ArgumentParserTests.cs
+++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs
@@ -9,21 +9,139 @@
namespace GitVersion.App.Tests;
[TestFixture]
+[NonParallelizable]
public class ArgumentParserTests : TestBase
{
private IEnvironment environment = null!;
private IArgumentParser argumentParser = null!;
private IFileSystem fileSystem = null!;
+ private string? originalConfigurationVersion;
[SetUp]
public void SetUp()
{
+ this.originalConfigurationVersion = System.Environment.GetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName);
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v6");
var sp = ConfigureServices(services => services.AddModule(new GitVersionAppModule()));
this.environment = sp.GetRequiredService();
this.argumentParser = sp.GetRequiredService();
this.fileSystem = sp.GetRequiredService();
}
+ [TearDown]
+ public void TearDown() =>
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, this.originalConfigurationVersion);
+
+ [Test]
+ public void OverrideConfigSupportsNestedV7RootAndBranchPaths()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+
+ var arguments = this.argumentParser.ParseArguments(
+ "--override-config calculation.tag-prefix=custom- " +
+ "--override-config calculation.branches.main.increment=Major " +
+ "--override-config output.branches.main.pre-release-weight=42");
+
+ var normalized = ConfigurationDocumentMapper.Normalize(
+ arguments.OverrideConfiguration!, ConfigurationVersion.V7, "test override");
+ ConfigurationHelper configurationHelper = new(normalized);
+ var configuration = configurationHelper.Configuration;
+ configuration.TagPrefixPattern.ShouldBe("custom-");
+ configuration.Branches["main"].Increment.ShouldBe(IncrementStrategy.Major);
+ configuration.Branches["main"].PreReleaseWeight.ShouldBe(42);
+ }
+
+ [Test]
+ public void OverrideConfigPreservesV7BranchNameCasing()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+
+ var arguments = this.argumentParser.ParseArguments(
+ "--override-config Calculation.Branches.ReleaseCandidate.Increment=Major");
+
+ var normalized = ConfigurationDocumentMapper.Normalize(
+ arguments.OverrideConfiguration!, ConfigurationVersion.V7, "test override");
+ ConfigurationHelper configurationHelper = new(normalized);
+ configurationHelper.Configuration.Branches["ReleaseCandidate"].Increment.ShouldBe(IncrementStrategy.Major);
+ }
+
+ [Test]
+ public void OverrideConfigRejectsDottedV7BranchNameWithClearDiagnostic()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+
+ var exception = Should.Throw(() =>
+ this.argumentParser.ParseArguments(
+ "--override-config calculation.branches.release.1.increment=Major"));
+
+ exception.Message.ShouldContain("Branch name 'release.1' contains '.'");
+ exception.Message.ShouldContain("Use a configuration file instead");
+ }
+
+ [Test]
+ public void OverrideConfigRejectsV6PathInV7WithReplacement()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+
+ var exception = Should.Throw(() =>
+ this.argumentParser.ParseArguments("--override-config tag-prefix=custom-"));
+
+ exception.Message.ShouldContain("calculation.tag-prefix");
+ exception.Message.ShouldContain("config migrate");
+ }
+
+ [Test]
+ public void OverrideConfigRejectsPropertyInWrongV7SectionWithReplacement()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+
+ var exception = Should.Throw(() =>
+ this.argumentParser.ParseArguments("--override-config calculation.update-build-number=false"));
+
+ exception.Message.ShouldContain("output.update-build-number");
+ }
+
+ [Test]
+ public void OverrideConfigSupportsV6BranchPath()
+ {
+ var arguments = this.argumentParser.ParseArguments("--override-config branches.main.increment=Major");
+
+ ConfigurationHelper configurationHelper = new(arguments.OverrideConfiguration);
+ configurationHelper.Configuration.Branches["main"].Increment.ShouldBe(IncrementStrategy.Major);
+ }
+
+ [Test]
+ public void OverrideConfigPreservesV6BranchNameCasing()
+ {
+ var arguments = this.argumentParser.ParseArguments(
+ "--override-config Branches.ReleaseCandidate.Increment=Major");
+
+ ConfigurationHelper configurationHelper = new(arguments.OverrideConfiguration);
+ configurationHelper.Configuration.Branches["ReleaseCandidate"].Increment.ShouldBe(IncrementStrategy.Major);
+ }
+
+ [Test]
+ public void OverrideConfigRejectsV7PathInV6WithReplacement()
+ {
+ var exception = Should.Throw(() =>
+ this.argumentParser.ParseArguments("--override-config output.update-build-number=false"));
+
+ exception.Message.ShouldContain("update-build-number");
+ exception.Message.ShouldContain("config migrate");
+ }
+
+ [Test]
+ public void OverrideConfigBatchValidationDoesNotApplyAnyValues()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+ var parser = new OverrideConfigurationOptionParser();
+
+ Should.Throw(() => parser.SetValues(
+ ["calculation.tag-prefix=custom-", "tag-prefix=legacy"], "--override-config"));
+
+ parser.GetOverrideConfiguration().ShouldBeEmpty();
+ }
+
[Test]
public void EmptyMeansUseCurrentDirectory()
{
diff --git a/src/GitVersion.App.Tests/ConfigurationVersionIntegrationTests.cs b/src/GitVersion.App.Tests/ConfigurationVersionIntegrationTests.cs
new file mode 100644
index 0000000000..5d4e486f9e
--- /dev/null
+++ b/src/GitVersion.App.Tests/ConfigurationVersionIntegrationTests.cs
@@ -0,0 +1,90 @@
+using GitVersion.App.Tests.Helpers;
+using GitVersion.Configuration;
+using GitVersion.Helpers;
+
+namespace GitVersion.App.Tests;
+
+[TestFixture]
+public class ConfigurationVersionIntegrationTests
+{
+ [Test]
+ public void V6AndV7ConfigurationCalculateTheSameVersion()
+ {
+ using var fixture = new EmptyRepositoryFixture();
+ fixture.MakeACommit();
+ var configurationPath = FileSystemHelper.Path.Combine(fixture.RepositoryPath, ConfigurationFileLocator.DefaultFileName);
+
+ FileSystemHelper.File.WriteAllText(configurationPath, "next-version: 2.0.0");
+ var v6Result = Execute(fixture.RepositoryPath, "v6");
+
+ FileSystemHelper.File.WriteAllText(configurationPath, """
+ calculation:
+ next-version: 2.0.0
+ output: {}
+ """);
+ var v7Result = Execute(fixture.RepositoryPath, "v7");
+
+ v6Result.ExitCode.ShouldBe(0);
+ v7Result.ExitCode.ShouldBe(0);
+ GetFullSemVer(v7Result.Output!).ShouldBe(GetFullSemVer(v6Result.Output!));
+ }
+
+ [TestCase("v6", false)]
+ [TestCase("v7", true)]
+ public void ShowConfigUsesSelectedConfigurationStructure(string version, bool nested)
+ {
+ using var fixture = new EmptyRepositoryFixture();
+ var result = GitVersionHelper.ExecuteIn(
+ fixture.RepositoryPath,
+ " --show-config",
+ logToFile: false,
+ new KeyValuePair(ConfigurationVersionSelector.EnvironmentVariableName, version));
+
+ result.ExitCode.ShouldBe(0);
+ result.Output.ShouldNotBeNull();
+ result.Output.Contains("calculation:", StringComparison.Ordinal).ShouldBe(nested);
+ result.Output.Contains("output:", StringComparison.Ordinal).ShouldBe(nested);
+ }
+
+ [Test]
+ public void DefaultCalculationDisplaysConfigurationVersionMismatchOnStandardError()
+ {
+ using var fixture = new EmptyRepositoryFixture();
+ fixture.MakeACommit();
+ var configurationPath = FileSystemHelper.Path.Combine(fixture.RepositoryPath, ConfigurationFileLocator.DefaultFileName);
+ FileSystemHelper.File.WriteAllText(configurationPath, "next-version: 2.0.0");
+
+ var result = Execute(fixture.RepositoryPath, "v7");
+
+ result.ExitCode.ShouldBe(1);
+ result.Output.ShouldNotBeNull();
+ result.Output.ShouldContain("An error occurred:");
+ result.Output.ShouldContain("uses the legacy v6 configuration structure");
+ result.Output.ShouldContain("gitversion config migrate");
+ }
+
+ [Test]
+ public void InvalidConfigurationVersionDisplaysDiagnosticOnStandardError()
+ {
+ using var fixture = new EmptyRepositoryFixture();
+ fixture.MakeACommit();
+
+ var result = Execute(fixture.RepositoryPath, "invalid");
+
+ result.ExitCode.ShouldBe(1);
+ result.Output.ShouldNotBeNull();
+ result.Output.ShouldContain("An error occurred:");
+ result.Output.ShouldContain("Unrecognized GITVERSION_CONFIGURATION_VERSION value 'invalid'");
+ result.Output.ShouldContain("Valid values are 'v6' and 'v7'");
+ }
+
+ private static ExecutionResults Execute(string repositoryPath, string version) =>
+ GitVersionHelper.ExecuteIn(
+ repositoryPath,
+ arguments: null,
+ logToFile: false,
+ new KeyValuePair(ConfigurationVersionSelector.EnvironmentVariableName, version));
+
+ private static string? GetFullSemVer(string json) =>
+ JsonDocument.Parse(json).RootElement.GetProperty("FullSemVer").GetString();
+}
diff --git a/src/GitVersion.App.Tests/LegacyArgumentParserTests.cs b/src/GitVersion.App.Tests/LegacyArgumentParserTests.cs
index deee50c64d..42fc182b28 100644
--- a/src/GitVersion.App.Tests/LegacyArgumentParserTests.cs
+++ b/src/GitVersion.App.Tests/LegacyArgumentParserTests.cs
@@ -9,21 +9,60 @@
namespace GitVersion.App.Tests;
[TestFixture]
+[NonParallelizable]
public class LegacyArgumentParserTests : TestBase
{
private IEnvironment environment = null!;
private IArgumentParser argumentParser = null!;
private IFileSystem fileSystem = null!;
+ private string? originalConfigurationVersion;
[SetUp]
public void SetUp()
{
+ this.originalConfigurationVersion = System.Environment.GetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName);
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v6");
var sp = ConfigureServices(services => services.AddModule(new GitVersionAppModule(useLegacyParser: true)));
this.environment = sp.GetRequiredService();
this.argumentParser = sp.GetRequiredService();
this.fileSystem = sp.GetRequiredService();
}
+ [TearDown]
+ public void TearDown() =>
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, this.originalConfigurationVersion);
+
+ [Test]
+ public void OverrideConfigSupportsNestedV7RootAndBranchPaths()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+
+ var arguments = this.argumentParser.ParseArguments(
+ "/overrideconfig calculation.tag-prefix=custom- " +
+ "/overrideconfig calculation.branches.main.increment=Major " +
+ "/overrideconfig output.branches.main.pre-release-weight=42");
+
+ var normalized = ConfigurationDocumentMapper.Normalize(
+ arguments.OverrideConfiguration!, ConfigurationVersion.V7, "test override");
+ ConfigurationHelper configurationHelper = new(normalized);
+ var configuration = configurationHelper.Configuration;
+ configuration.TagPrefixPattern.ShouldBe("custom-");
+ configuration.Branches["main"].Increment.ShouldBe(IncrementStrategy.Major);
+ configuration.Branches["main"].PreReleaseWeight.ShouldBe(42);
+ }
+
+ [Test]
+ public void OverrideConfigRejectsV6PathInV7WithReplacement()
+ {
+ System.Environment.SetEnvironmentVariable(ConfigurationVersionSelector.EnvironmentVariableName, "v7");
+
+ var exception = Should.Throw(() =>
+ this.argumentParser.ParseArguments("/overrideconfig tag-prefix=custom-"));
+
+ exception.Message.ShouldContain("calculation.tag-prefix");
+ exception.Message.ShouldContain("config migrate");
+ }
+
[Test]
public void EmptyMeansUseCurrentDirectory()
{
diff --git a/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs b/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs
index 408d50dc65..24f08780fd 100644
--- a/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs
+++ b/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs
@@ -150,10 +150,12 @@ public async Task VerifyBitBucketPipelinesPullRequest(string pullRequestRef)
}
private const string GitLabMergeRequestPullRequestConfig = """
- workflow: GitFlow/v1
- branches:
- pull-request:
- regex: ^merge-requests/(?\d+)/(head|merge)$
+ calculation:
+ workflow: GitFlow/v1
+ branches:
+ pull-request:
+ regex: ^merge-requests/(?\d+)/(head|merge)$
+ output: {}
""";
private static async Task VerifyGitLabMergeRequestVersionIsCalculatedProperly(string mergeRequestRef, Dictionary env)
diff --git a/src/GitVersion.App/ArgumentParser.cs b/src/GitVersion.App/ArgumentParser.cs
index efdf5c24b0..f271ddb9bd 100644
--- a/src/GitVersion.App/ArgumentParser.cs
+++ b/src/GitVersion.App/ArgumentParser.cs
@@ -591,24 +591,7 @@ private static void ParseOverrideConfig(Arguments arguments, IReadOnlyCollection
}
var parser = new OverrideConfigurationOptionParser();
-
- foreach (var keyValueOption in values)
- {
- var keyAndValue = QuotedStringHelpers.SplitUnquoted(keyValueOption, '=');
- if (keyAndValue.Length != 2)
- {
- throw new WarningException($"Could not parse --override-config option: {keyValueOption}. Ensure it is in format 'key=value'.");
- }
-
- var optionKey = keyAndValue[0].ToLowerInvariant();
- if (!OverrideConfigurationOptionParser.SupportedProperties.Contains(optionKey))
- {
- throw new WarningException($"Could not parse --override-config option: {keyValueOption}. Unsupported key '{optionKey}'.");
- }
-
- parser.SetValue(optionKey, keyAndValue[1]);
- }
-
+ parser.SetValues(values, "--override-config");
arguments.OverrideConfiguration = parser.GetOverrideConfiguration();
}
diff --git a/src/GitVersion.App/GitVersionExecutor.cs b/src/GitVersion.App/GitVersionExecutor.cs
index 1d102033c4..2bd462d3f8 100644
--- a/src/GitVersion.App/GitVersionExecutor.cs
+++ b/src/GitVersion.App/GitVersionExecutor.cs
@@ -70,8 +70,9 @@ private int RunGitVersionTool(GitVersionOptions gitVersionOptions)
this.gitVersionOutputTool.UpdateAssemblyInfo(variables);
this.gitVersionOutputTool.UpdateWixVersionFile(variables);
}
- catch (WarningException exception)
+ catch (Exception exception) when (exception is WarningException or ConfigurationException)
{
+ WriteError(exception);
this.logger.LogError(exception, """
An error occurred:
{Message}
@@ -103,6 +104,12 @@ private int RunGitVersionTool(GitVersionOptions gitVersionOptions)
return 0;
}
+ private static void WriteError(Exception exception)
+ {
+ Console.Error.WriteLine("An error occurred:");
+ Console.Error.WriteLine(exception.Message);
+ }
+
private void Initialize(GitVersionOptions gitVersionOptions)
{
if (gitVersionOptions.Diag)
diff --git a/src/GitVersion.App/LegacyArgumentParser.cs b/src/GitVersion.App/LegacyArgumentParser.cs
index 896f74f3ce..24a8410bfc 100644
--- a/src/GitVersion.App/LegacyArgumentParser.cs
+++ b/src/GitVersion.App/LegacyArgumentParser.cs
@@ -511,25 +511,7 @@ private static void ParseOverrideConfig(Arguments arguments, IReadOnlyCollection
}
var parser = new OverrideConfigurationOptionParser();
-
- // key=value
- foreach (var keyValueOption in values)
- {
- var keyAndValue = QuotedStringHelpers.SplitUnquoted(keyValueOption, '=');
- if (keyAndValue.Length != 2)
- {
- throw new WarningException($"Could not parse /overrideconfig option: {keyValueOption}. Ensure it is in format 'key=value'.");
- }
-
- var optionKey = keyAndValue[0].ToLowerInvariant();
- if (!OverrideConfigurationOptionParser.SupportedProperties.Contains(optionKey))
- {
- throw new WarningException($"Could not parse /overrideconfig option: {keyValueOption}. Unsupported key '{optionKey}'.");
- }
-
- parser.SetValue(optionKey, keyAndValue[1]);
- }
-
+ parser.SetValues(values, "/overrideconfig");
arguments.OverrideConfiguration = parser.GetOverrideConfiguration();
}
diff --git a/src/GitVersion.App/OverrideConfigurationOptionParser.cs b/src/GitVersion.App/OverrideConfigurationOptionParser.cs
index 9b7a3ee403..a25538631e 100644
--- a/src/GitVersion.App/OverrideConfigurationOptionParser.cs
+++ b/src/GitVersion.App/OverrideConfigurationOptionParser.cs
@@ -12,6 +12,9 @@ internal class OverrideConfigurationOptionParser
internal static ILookup SupportedProperties => _lazySupportedProperties.Value;
+ private static readonly Lazy> _lazySupportedBranchProperties =
+ new(GetSupportedBranchProperties, true);
+
///
/// Dynamically creates of
/// properties supported as a part of command line '/overrideconfig' option.
@@ -50,7 +53,230 @@ private static bool IsSupportedPropertyType(Type propertyType)
|| unwrappedType == typeof(VersionStrategies[]);
}
- internal void SetValue(string key, string value) => this.overrideConfiguration[key] = QuotedStringHelpers.UnquoteText(value);
+ private static bool TryNormalizeAndValidate(string key, out string normalizedKey, out string? error)
+ {
+ var version = ConfigurationVersionSelector.Resolve();
+ var segments = key.Split('.');
+ NormalizeSegments(segments);
+ normalizedKey = string.Join('.', segments);
+
+ if (IsAmbiguousBranchPath(segments, out var branchName))
+ {
+ error = $"Branch name '{branchName}' contains '.', which cannot be addressed by an override configuration path. " +
+ "Use a configuration file instead.";
+ return false;
+ }
+
+ if (IsValidPath(version, segments))
+ {
+ error = null;
+ return true;
+ }
+
+ var replacement = GetReplacement(version, segments);
+ error = replacement is null
+ ? $"Unsupported key '{normalizedKey}'."
+ : $"Key '{normalizedKey}' is not valid in the selected configuration structure. Use '{replacement}' instead. " +
+ "Run 'gitversion config migrate' to convert a legacy configuration.";
+ return false;
+ }
+
+ internal void SetValues(IReadOnlyCollection values, string optionName)
+ {
+ List<(string Key, string Value)> parsedOptions = [];
+
+ foreach (var keyValueOption in values)
+ {
+ var keyAndValue = QuotedStringHelpers.SplitUnquoted(keyValueOption, '=');
+ if (keyAndValue.Length != 2)
+ {
+ throw new WarningException($"Could not parse {optionName} option: {keyValueOption}. Ensure it is in format 'key=value'.");
+ }
+
+ if (!TryNormalizeAndValidate(keyAndValue[0], out var optionKey, out var error))
+ {
+ throw new WarningException($"Could not parse {optionName} option: {keyValueOption}. {error}");
+ }
+
+ parsedOptions.Add((optionKey, keyAndValue[1]));
+ }
+
+ foreach (var (key, value) in parsedOptions)
+ {
+ SetValue(key, value);
+ }
+ }
+
+ internal void SetValue(string key, string value)
+ {
+ var segments = key.Split('.');
+ IDictionary