Skip to content

Commit 45515e7

Browse files
authored
Merge pull request #3898 from HHobeck/feature/Same-version-computed-on-different-branches
[Feature] Same version computed on different branches
2 parents 0fc8529 + 589e353 commit 45515e7

File tree

77 files changed

+1084
-806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1084
-806
lines changed

BREAKING_CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
* VersionInBranchName
5454
* TrunkBased
5555
* The initialization wizard has been removed.
56+
* On the `develop`, `release` and `hotfix` branch the introduced branch related property `prevent-increment-when-current-commit-tagged` has been set to `false` to get the incremented instead of the tagged semantic version.
5657
5758
## v5.0.0
5859

docs/input/docs/reference/configuration.md

Lines changed: 236 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,28 @@ found that is generally what is needed when using GitFlow.
3131
To see the effective configuration (defaults and overrides), you can run
3232
`gitversion /showConfig`.
3333

34-
To create your config file just type `gitversion init` in your repo directory,
35-
after [installing][installing]. A minimal `GitVersion.yml` configuration file will be
36-
created. Modify this to suit your needs.
3734

3835
## Global configuration
3936

40-
The global configuration looks like this:
37+
The following supported workflow configurations are available in GitVersion and can be referenced by the workflow property:
38+
- GitFlow (GitFlow/v1)
39+
- GitHubFlow (GitHubFlow/v1)
40+
- TrunkBased (TrunkBased/v1)
41+
42+
Example of using a `TrunkBased` workflow with a different `tag-prefix`:
43+
44+
```yaml
45+
workflow: TrunkBased/v1
46+
tag-prefix: '[abc]'
47+
```
48+
49+
The built-in configuration for the `GitFlow` workflow (`workflow: GitFlow/v1`) looks like:
4150

4251
```yaml
4352
assembly-versioning-scheme: MajorMinorPatch
4453
assembly-file-versioning-scheme: MajorMinorPatch
4554
tag-prefix: '[vV]?'
55+
version-in-branch-pattern: (?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
4656
major-version-bump-message: '\+semver:\s?(breaking|major)'
4757
minor-version-bump-message: '\+semver:\s?(feature|minor)'
4858
patch-version-bump-message: '\+semver:\s?(fix|patch)'
@@ -52,16 +62,22 @@ commit-date-format: yyyy-MM-dd
5262
merge-message-formats: {}
5363
update-build-number: true
5464
semantic-version-format: Strict
55-
strategies: [ConfigNext, MergeMessage, TaggedCommit, TrackReleaseBranches, VersionInBranchName]
65+
strategies:
66+
- ConfiguredNextVersion
67+
- MergeMessage
68+
- TaggedCommit
69+
- TrackReleaseBranches
70+
- VersionInBranchName
5671
branches:
5772
develop:
58-
mode: ContinuousDeployment
5973
label: alpha
6074
increment: Minor
6175
prevent-increment-of-merged-branch-version: false
76+
prevent-increment-when-tagged: false
6277
track-merge-target: true
6378
regex: ^dev(elop)?(ment)?$
6479
source-branches: []
80+
is-source-branch-for: []
6581
tracks-release-branches: true
6682
is-release-branch: false
6783
is-main-branch: false
@@ -75,27 +91,31 @@ branches:
7591
source-branches:
7692
- develop
7793
- release
94+
is-source-branch-for: []
7895
tracks-release-branches: false
7996
is-release-branch: false
8097
is-main-branch: true
8198
pre-release-weight: 55000
8299
release:
100+
mode: ManualDeployment
83101
label: beta
84102
increment: None
85103
prevent-increment-of-merged-branch-version: true
104+
prevent-increment-when-tagged: false
86105
track-merge-target: false
87106
regex: ^releases?[/-]
88107
source-branches:
89108
- develop
90109
- main
91110
- support
92111
- release
112+
is-source-branch-for: []
93113
tracks-release-branches: false
94114
is-release-branch: true
95115
is-main-branch: false
96116
pre-release-weight: 30000
97117
feature:
98-
mode: ContinuousDelivery
118+
mode: ManualDeployment
99119
label: '{BranchName}'
100120
increment: Inherit
101121
regex: ^features?[/-](?<BranchName>.+)
@@ -106,6 +126,7 @@ branches:
106126
- feature
107127
- support
108128
- hotfix
129+
is-source-branch-for: []
109130
pre-release-weight: 30000
110131
pull-request:
111132
mode: ContinuousDelivery
@@ -120,17 +141,21 @@ branches:
120141
- feature
121142
- support
122143
- hotfix
144+
is-source-branch-for: []
123145
pre-release-weight: 30000
124146
hotfix:
125-
mode: ContinuousDelivery
147+
mode: ManualDeployment
126148
label: beta
127149
increment: Inherit
150+
prevent-increment-when-tagged: false
128151
regex: ^hotfix(es)?[/-]
129152
source-branches:
130153
- release
131154
- main
132155
- support
133156
- hotfix
157+
is-source-branch-for: []
158+
is-release-branch: true
134159
pre-release-weight: 30000
135160
support:
136161
label: ''
@@ -140,15 +165,16 @@ branches:
140165
regex: ^support[/-]
141166
source-branches:
142167
- main
168+
is-source-branch-for: []
143169
tracks-release-branches: false
144170
is-release-branch: false
145171
is-main-branch: true
146172
pre-release-weight: 55000
147173
unknown:
148-
mode: ContinuousDelivery
174+
mode: ManualDeployment
149175
label: '{BranchName}'
150176
increment: Inherit
151-
regex: (?<BranchName>.*)
177+
regex: (?<BranchName>.+)
152178
source-branches:
153179
- main
154180
- develop
@@ -157,12 +183,200 @@ branches:
157183
- pull-request
158184
- hotfix
159185
- support
186+
is-source-branch-for: []
187+
ignore:
188+
sha: []
189+
mode: ContinuousDelivery
190+
label: '{BranchName}'
191+
increment: Inherit
192+
prevent-increment-of-merged-branch-version: false
193+
prevent-increment-when-tagged: true
194+
track-merge-target: false
195+
track-merge-message: true
196+
commit-message-incrementing: Enabled
197+
regex: ''
198+
source-branches: []
199+
is-source-branch-for: []
200+
tracks-release-branches: false
201+
is-release-branch: false
202+
is-main-branch: false
203+
```
204+
205+
The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
206+
207+
```yaml
208+
assembly-versioning-scheme: MajorMinorPatch
209+
assembly-file-versioning-scheme: MajorMinorPatch
210+
tag-prefix: '[vV]?'
211+
version-in-branch-pattern: (?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
212+
major-version-bump-message: '\+semver:\s?(breaking|major)'
213+
minor-version-bump-message: '\+semver:\s?(feature|minor)'
214+
patch-version-bump-message: '\+semver:\s?(fix|patch)'
215+
no-bump-message: '\+semver:\s?(none|skip)'
216+
tag-pre-release-weight: 60000
217+
commit-date-format: yyyy-MM-dd
218+
merge-message-formats: {}
219+
update-build-number: true
220+
semantic-version-format: Strict
221+
strategies:
222+
- ConfiguredNextVersion
223+
- MergeMessage
224+
- TaggedCommit
225+
- TrackReleaseBranches
226+
- VersionInBranchName
227+
branches:
228+
main:
229+
label: ''
230+
increment: Patch
231+
prevent-increment-of-merged-branch-version: true
232+
track-merge-target: false
233+
regex: ^master$|^main$
234+
source-branches:
235+
- release
236+
is-source-branch-for: []
237+
tracks-release-branches: false
238+
is-release-branch: false
239+
is-main-branch: true
240+
pre-release-weight: 55000
241+
release:
242+
mode: ManualDeployment
243+
label: beta
244+
increment: None
245+
prevent-increment-of-merged-branch-version: true
246+
prevent-increment-when-tagged: false
247+
track-merge-target: false
248+
regex: ^releases?[/-]
249+
source-branches:
250+
- main
251+
- release
252+
is-source-branch-for: []
253+
tracks-release-branches: false
254+
is-release-branch: true
255+
is-main-branch: false
256+
pre-release-weight: 30000
257+
feature:
258+
mode: ManualDeployment
259+
label: '{BranchName}'
260+
increment: Inherit
261+
regex: ^features?[/-](?<BranchName>.+)
262+
source-branches:
263+
- main
264+
- release
265+
- feature
266+
is-source-branch-for: []
267+
pre-release-weight: 30000
268+
pull-request:
269+
mode: ContinuousDelivery
270+
label: PullRequest
271+
increment: Inherit
272+
label-number-pattern: '[/-](?<number>\d+)'
273+
regex: ^(pull|pull\-requests|pr)[/-]
274+
source-branches:
275+
- main
276+
- release
277+
- feature
278+
is-source-branch-for: []
279+
pre-release-weight: 30000
280+
unknown:
281+
mode: ManualDeployment
282+
label: '{BranchName}'
283+
increment: Inherit
284+
regex: (?<BranchName>.+)
285+
source-branches:
286+
- main
287+
- release
288+
- feature
289+
- pull-request
290+
is-source-branch-for: []
160291
ignore:
161292
sha: []
162293
mode: ContinuousDelivery
163294
label: '{BranchName}'
164295
increment: Inherit
165296
prevent-increment-of-merged-branch-version: false
297+
prevent-increment-when-tagged: true
298+
track-merge-target: false
299+
track-merge-message: true
300+
commit-message-incrementing: Enabled
301+
regex: ''
302+
source-branches: []
303+
is-source-branch-for: []
304+
tracks-release-branches: false
305+
is-release-branch: false
306+
is-main-branch: false
307+
```
308+
309+
The supported built-in configuration for the `TrunkBased` workflow (`workflow: TrunkBased/v1`) looks like:
310+
311+
```yaml
312+
assembly-versioning-scheme: MajorMinorPatch
313+
assembly-file-versioning-scheme: MajorMinorPatch
314+
tag-prefix: '[vV]?'
315+
version-in-branch-pattern: (?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
316+
major-version-bump-message: '\+semver:\s?(breaking|major)'
317+
minor-version-bump-message: '\+semver:\s?(feature|minor)'
318+
patch-version-bump-message: '\+semver:\s?(fix|patch)'
319+
no-bump-message: '\+semver:\s?(none|skip)'
320+
tag-pre-release-weight: 60000
321+
commit-date-format: yyyy-MM-dd
322+
merge-message-formats: {}
323+
update-build-number: true
324+
semantic-version-format: Strict
325+
strategies:
326+
- TrunkBased
327+
- ConfiguredNextVersion
328+
branches:
329+
main:
330+
mode: ContinuousDeployment
331+
label: ''
332+
increment: Patch
333+
prevent-increment-of-merged-branch-version: true
334+
track-merge-target: false
335+
regex: ^master$|^main$
336+
source-branches: []
337+
tracks-release-branches: false
338+
is-release-branch: false
339+
is-main-branch: true
340+
pre-release-weight: 55000
341+
feature:
342+
increment: Minor
343+
regex: ^features?[/-](?<BranchName>.+)
344+
prevent-increment-when-tagged: false
345+
source-branches:
346+
- main
347+
pre-release-weight: 30000
348+
hotfix:
349+
increment: Patch
350+
regex: ^hotfix(es)?[/-](?<BranchName>.+)
351+
prevent-increment-when-tagged: false
352+
source-branches:
353+
- main
354+
pre-release-weight: 30000
355+
pull-request:
356+
mode: ManualDeployment
357+
label: PullRequest
358+
increment: Inherit
359+
label-number-pattern: '[/-](?<number>\d+)'
360+
regex: ^(pull|pull\-requests|pr)[/-]
361+
source-branches:
362+
- main
363+
pre-release-weight: 30000
364+
unknown:
365+
mode: ManualDeployment
366+
increment: Inherit
367+
regex: (?<BranchName>.+)
368+
source-branches:
369+
- main
370+
- release
371+
- feature
372+
- pull-request
373+
ignore:
374+
sha: []
375+
mode: ManualDeployment
376+
label: '{BranchName}'
377+
increment: Inherit
378+
prevent-increment-of-merged-branch-version: false
379+
prevent-increment-when-tagged: true
166380
track-merge-target: false
167381
track-merge-message: true
168382
commit-message-incrementing: Enabled
@@ -176,7 +390,7 @@ The details of the available options are as follows:
176390

177391
### workflow
178392

179-
The base template of the configuration to use. Possible values are: GitFlow/v1 or GitHubFlow/v1
393+
The base template of the configuration to use. Possible values are: GitFlow/v1 or GitHubFlow/v1 or TrunkBased/v1. Defaults to GitFlow/v1 if not set.
180394

181395
### next-version
182396

@@ -244,7 +458,7 @@ The default value is `{InformationalVersion}`.
244458
### mode
245459

246460
Sets the `mode` of how GitVersion should create a new version. Read more at
247-
[versioning modes][modes].
461+
[deployment modes][modes].
248462

249463
### increment
250464

@@ -588,6 +802,10 @@ In a GitFlow-based repository, setting this option can have implications on the
588802
better version source proposed by the `MergeMessageBaseVersionStrategy`. For
589803
more details and an in-depth analysis, please see [the discussion][2506].
590804

805+
### prevent-increment-when-current-commit-tagged
806+
807+
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.
808+
591809
### label-number-pattern
592810

593811
Pull requests require us to extract the pre-release number out of the branch
@@ -677,9 +895,9 @@ Example of invalid `Strict`, but valid `Loose`
677895
### strategies
678896
679897
Specifies which version strategy implementation (one ore more) will be used to determine the next version. Following values are supported and can be combined:
680-
* ConfiguredNextVersion
681-
* MergeMessage
682-
* TaggedCommit
683-
* TrackReleaseBranches
684-
* VersionInBranchName
685-
* TrunkBased
898+
- ConfiguredNextVersion
899+
- MergeMessage
900+
- TaggedCommit
901+
- TrackReleaseBranches
902+
- VersionInBranchName
903+
- TrunkBased

0 commit comments

Comments
 (0)