Skip to content

Commit 3c8c88b

Browse files
Merge branch 'master' into feature/dynamic
2 parents 3badcd2 + 8650152 commit 3c8c88b

File tree

95 files changed

+1642
-664
lines changed

Some content is hidden

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

95 files changed

+1642
-664
lines changed

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": ".NET Core Launch (console)",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"program": "${workspaceRoot}/tools/Cake.CoreCLR/Cake.dll",
9+
"args": [
10+
"${workspaceRoot}/build.cake",
11+
"--debug",
12+
"--verbosity=diagnostic"
13+
],
14+
"cwd": "${workspaceRoot}",
15+
"stopAtEntry": true,
16+
"externalConsole": false
17+
}
18+
]
19+
}

README.md

Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,86 @@
1-
![Icon](https://raw.github.com/GitTools/GitVersion/master/docs/img/package_icon.png)
1+
![Icon][icon]
2+
23
# GitVersion
3-
Versioning when using git, solved. GitVersion looks at your git history and works out the semantic version ([semver.org](http://semver.org)) of the commit being built.
4+
Versioning when using git, solved. GitVersion looks at your git history and
5+
works out the [semantic version][semver] of the commit being built.
6+
7+
[![Gitter][gitter-badge]][gitter]
8+
[![Build status][appveyor-badge]][appveyor]
9+
[![Build Status][travis-badge]][travis]
10+
11+
| | Stable | Pre-release |
12+
| -------------------------: | :---------------------------------: | :---------------------------------------: |
13+
| **Docs** | [![Docs][docs-badge]][docs] | [![Docs][docs-pre-badge]][docs-pre] |
14+
| **GitHub Release** | - | [![GitHub release][gh-rel-badge]][gh-rel] |
15+
| **GitVersion.Portable** | [![Chocolatey][choco-badge]][choco] | [![Chocolatey][choco-pre-badge]][choco] |
16+
| **GitVersionTask** | [![NuGet][gvt-badge]][gvt] | [![NuGet][gvt-pre-badge]][gvt] |
17+
| **GitVersion.CommandLine** | [![NuGet][gvc-badge]][gvc] | [![NuGet][gvc-pre-badge]][gvc] |
18+
| **Gem** | [![Gem][gem-badge]][gem] | - |
19+
| **Homebrew** | [![homebrew][brew-badge]][brew] | - |
420

5-
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/GitTools/GitVersion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6-
[![Build status](https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/master?svg=true)](https://ci.appveyor.com/project/GitTools/gitversion/branch/master)
7-
[![Build Status](https://travis-ci.org/GitTools/GitVersion.svg?branch=master)](https://travis-ci.org/GitTools/GitVersion)
21+
## Compatibility
22+
GitVersion works on Mac, Linux with Mono and Windows.
823

9-
||Stable|Pre-release|
10-
|:--:|:--:|:--:|
11-
|Docs|[![Documentation Status](https://readthedocs.org/projects/gitversion/badge/?version=stable)](http://gitversion.readthedocs.org/en/stable/)|[![Documentation Status](https://readthedocs.org/projects/gitversion/badge/?version=latest)](http://gitversion.readthedocs.org/en/latest/)|
12-
|GitHub Release|-|[![GitHub release](https://img.shields.io/github/release/gittools/gitversion.svg)](https://github.com/GitTools/GitVersion/releases/latest)|
13-
|Chocolatey (GitVersion.Portable)|[![Chocolatey](https://img.shields.io/chocolatey/v/gitversion.portable.svg)](https://chocolatey.org/packages/GitVersion.Portable)|[![Chocolatey](https://img.shields.io/chocolatey/vpre/gitversion.portable.svg)](https://chocolatey.org/packages/GitVersion.Portable)|
14-
|NuGet (GitVersionTask)|[![NuGet](https://img.shields.io/nuget/v/GitVersionTask.svg)](https://www.nuget.org/packages/GitVersionTask)|[![NuGet](https://img.shields.io/nuget/vpre/GitVersionTask.svg)](https://www.nuget.org/packages/GitVersionTask)|
15-
|NuGet (GitVersion.CommandLine)|[![NuGet](https://img.shields.io/nuget/v/GitVersion.CommandLine.svg)](https://www.nuget.org/packages/GitVersion.CommandLine)|[![NuGet](https://img.shields.io/nuget/vpre/GitVersion.CommandLine.svg)](https://www.nuget.org/packages/GitVersion.CommandLine)|
16-
|Gem|[![Gem](https://img.shields.io/gem/v/gitversion.svg)](https://rubygems.org/gems/gitversion)|[![Gem](https://img.shields.io/gem/v/gitversion.svg)](https://rubygems.org/gems/gitversion)|
24+
Tip: If you get `System.TypeInitializationException: The type initializer for
25+
'LibGit2Sharp.Core.NativeMethods' threw an exception. --->
26+
System.DllNotFoundException: lib/linux/x86_64/libgit2-baa87df.so`
27+
28+
You likely need to install `libcurl3`. Run `sudo get-get install libcurl3`
1729

1830
## Quick Links
19-
- [Documentation](http://gitversion.readthedocs.org/en/latest)
20-
- [Contributing](https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md)
21-
- [Why GitVersion](http://gitversion.readthedocs.org/en/latest/why)
22-
- [Usage](http://gitversion.readthedocs.org/en/latest/usage/usage/)
23-
- [How it works](http://gitversion.readthedocs.org/en/latest/more-info/how-it-works/)
24-
- [FAQ](http://gitversion.readthedocs.org/en/latest/faq/)
25-
- [Who is using GitVersion](http://gitversion.readthedocs.org/en/latest/who/)
31+
- [Documentation][docs]
32+
[Contributing][contribute]
33+
- [Why GitVersion][why]
34+
- [Usage][usage]
35+
- [How it works][how]
36+
- [FAQ][faq]
37+
- [Who is using GitVersion][who]
2638

2739
## GitVersion in action!
28-
![README](https://raw.github.com/GitTools/GitVersion/master/docs/img/README.png)
40+
![README][gv-in-action]
2941

3042
You are seeing:
3143

3244
- Pull requests being built as pre-release builds
3345
- A branch called `release-1.0.0` producing beta v1 packages
3446

3547
## Icon
36-
<a href="http://thenounproject.com/noun/tree/#icon-No13389" target="_blank">Tree</a> designed by <a href="http://thenounproject.com/david.chapman" target="_blank">David Chapman</a> from The Noun Project
48+
<a href="http://thenounproject.com/noun/tree/#icon-No13389"
49+
target="_blank">Tree</a> designed by <a
50+
href="http://thenounproject.com/david.chapman" target="_blank">David Chapman</a>
51+
from The Noun Project
52+
53+
[icon]: https://raw.github.com/GitTools/GitVersion/master/docs/img/package_icon.png
54+
[semver]: http://semver.org
55+
[gitter]: https://gitter.im/GitTools/GitVersion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
56+
[gitter-badge]: https://badges.gitter.im/Join+Chat.svg
57+
[appveyor]: https://ci.appveyor.com/project/GitTools/gitversion/branch/master
58+
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/master?svg=true
59+
[travis]: https://travis-ci.org/GitTools/GitVersion
60+
[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=master
61+
[docs]: http://gitversion.readthedocs.org/en/stable/
62+
[docs-badge]: https://readthedocs.org/projects/gitversion/badge/?version=stable
63+
[docs-pre]: http://gitversion.readthedocs.org/en/latest/
64+
[docs-pre-badge]: https://readthedocs.org/projects/gitversion/badge/?version=latest
65+
[gh-rel]: https://github.com/GitTools/GitVersion/releases/latest
66+
[gh-rel-badge]: https://img.shields.io/github/release/gittools/gitversion.svg
67+
[choco]: https://chocolatey.org/packages/GitVersion.Portable
68+
[choco-badge]: https://img.shields.io/chocolatey/v/gitversion.portable.svg
69+
[choco-pre-badge]: https://img.shields.io/chocolatey/vpre/gitversion.portable.svg
70+
[gvt]: https://www.nuget.org/packages/GitVersionTask
71+
[gvt-badge]: https://img.shields.io/nuget/v/GitVersionTask.svg
72+
[gvt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersionTask.svg
73+
[gvc]: https://www.nuget.org/packages/GitVersion.CommandLine
74+
[gvc-badge]: https://img.shields.io/nuget/v/GitVersion.CommandLine.svg
75+
[gvc-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.CommandLine.svg
76+
[gem-badge]: https://img.shields.io/gem/v/gitversion.svg
77+
[gem]: https://rubygems.org/gems/gitversion
78+
[brew]: http://brew.sh/
79+
[brew-badge]: https://img.shields.io/homebrew/v/gitversion.svg
80+
[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md
81+
[why]: http://gitversion.readthedocs.org/en/latest/why
82+
[usage]: http://gitversion.readthedocs.org/en/latest/usage/usage/
83+
[how]: http://gitversion.readthedocs.org/en/latest/more-info/how-it-works/
84+
[faq]: http://gitversion.readthedocs.org/en/latest/faq/
85+
[who]: http://gitversion.readthedocs.org/en/latest/who/
86+
[gv-in-action]: https://raw.github.com/GitTools/GitVersion/master/docs/img/README.png

build.cake

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bool IsTagged = (BuildSystem.AppVeyor.Environment.Repository.Tag.IsTag &&
1414
!string.IsNullOrWhiteSpace(BuildSystem.AppVeyor.Environment.Repository.Tag.Name));
1515
bool IsMainGitVersionRepo = StringComparer.OrdinalIgnoreCase.Equals("gittools/gitversion", BuildSystem.AppVeyor.Environment.Repository.Name);
1616
bool IsPullRequest = BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
17+
bool IsMainGitVersionBranch = StringComparer.OrdinalIgnoreCase.Equals("master", BuildSystem.AppVeyor.Environment.Repository.Branch);
1718

1819
void Build(string configuration, string nugetVersion, string semVersion, string version, string preReleaseTag)
1920
{
@@ -120,6 +121,7 @@ Task("Zip-Files")
120121

121122
Task("Create-Release-Notes")
122123
.IsDependentOn("Build")
124+
.WithCriteria(() => IsMainGitVersionRepo && IsMainGitVersionBranch && !IsPullRequest)
123125
.Does(() =>
124126
{
125127
var githubToken = EnvironmentVariable("GitHubToken");
@@ -160,8 +162,7 @@ Task("Upload-AppVeyor-Artifacts")
160162
"NuGetTaskBuild:GitVersionTask." + nugetVersion +".nupkg",
161163
"GitVersionTfsTaskBuild:gittools.gitversion-" + semVersion +".vsix",
162164
"GemBuild:" + gem,
163-
"zip:GitVersion_" + nugetVersion + ".zip",
164-
"releaseNotes:releasenotes.md"
165+
"zip:GitVersion_" + nugetVersion + ".zip"
165166
});
166167

167168
AppVeyor.UploadArtifact("build/NuGetExeBuild/GitVersion.Portable." + nugetVersion +".nupkg");
@@ -171,8 +172,15 @@ Task("Upload-AppVeyor-Artifacts")
171172
AppVeyor.UploadArtifact("build/GitVersionTfsTaskBuild/gittools.gitversion-" + semVersion + ".vsix");
172173
AppVeyor.UploadArtifact("build/GitVersion_" + nugetVersion + ".zip");
173174
AppVeyor.UploadArtifact("build/GemBuild/" + gem);
174-
AppVeyor.UploadArtifact("build/releasenotes.md");
175175
AppVeyor.UploadArtifact("build/artifacts");
176+
177+
if(IsMainGitVersionRepo && IsMainGitVersionBranch && !IsPullRequest)
178+
{
179+
if(FileExists("build/releasenotes.md"))
180+
{
181+
AppVeyor.UploadArtifact("build/releasenotes.md");
182+
}
183+
}
176184
});
177185

178186

docs/configuration.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Configuration
1+
# Configuration
22
GitVersion 3.0 is mainly powered by configuration and no longer has branching
33
strategies hard coded.
44

@@ -32,6 +32,7 @@ next-version: 1.0
3232
assembly-versioning-scheme: MajorMinorPatch
3333
assembly-informational-format: '{InformationalVersion}'
3434
mode: ContinuousDelivery
35+
increment: Inherit
3536
continuous-delivery-fallback-tag: ci
3637
tag-prefix: '[vV]'
3738
major-version-bump-message: '\+semver:\s?(breaking|major)'
@@ -70,6 +71,11 @@ value of the `AssemblyInformationalVersion` attribute. Default set to
7071
Sets the `mode` of how GitVersion should create a new version. Read more at
7172
[versioning mode](/reference/versioning-mode.md).
7273

74+
### increment
75+
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`.
76+
77+
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), [prevent-increment-of-merged-branch-version](#prevent-increment-of-merged-branch-version) and [is-develop](#is-develop).
78+
7379
### continuous-delivery-fallback-tag
7480
When using `mode: ContinuousDeployment`, the value specified in
7581
`continuous-delivery-fallback-tag` will be used as the pre-release tag for
@@ -163,7 +169,7 @@ branches:
163169
increment: Patch
164170
prevent-increment-of-merged-branch-version: true
165171
track-merge-target: false
166-
is-develop: false
172+
tracks-release-branches: false
167173
is-release-branch: false
168174
release:
169175
regex: releases?[/-]
@@ -172,7 +178,7 @@ branches:
172178
increment: Patch
173179
prevent-increment-of-merged-branch-version: true
174180
track-merge-target: false
175-
is-develop: false
181+
tracks-release-branches: false
176182
is-release-branch: true
177183
feature:
178184
regex: features?[/-]
@@ -181,7 +187,7 @@ branches:
181187
increment: Inherit
182188
prevent-increment-of-merged-branch-version: false
183189
track-merge-target: false
184-
is-develop: false
190+
tracks-release-branches: false
185191
is-release-branch: false
186192
pull-request:
187193
regex: (pull|pull\-requests|pr)[/-]
@@ -191,7 +197,7 @@ branches:
191197
prevent-increment-of-merged-branch-version: false
192198
tag-number-pattern: '[/-](?<number>\d+)[-/]'
193199
track-merge-target: false
194-
is-develop: false
200+
tracks-release-branches: false
195201
is-release-branch: false
196202
hotfix:
197203
regex: hotfix(es)?[/-]
@@ -200,7 +206,7 @@ branches:
200206
increment: Patch
201207
prevent-increment-of-merged-branch-version: false
202208
track-merge-target: false
203-
is-develop: false
209+
tracks-release-branches: false
204210
is-release-branch: false
205211
support:
206212
regex: support[/-]
@@ -209,7 +215,7 @@ branches:
209215
increment: Patch
210216
prevent-increment-of-merged-branch-version: true
211217
track-merge-target: false
212-
is-develop: false
218+
tracks-release-branches: false
213219
is-release-branch: false
214220
develop:
215221
regex: dev(elop)?(ment)?$
@@ -218,7 +224,7 @@ branches:
218224
increment: Minor
219225
prevent-increment-of-merged-branch-version: false
220226
track-merge-target: true
221-
is-develop: true
227+
tracks-release-branches: true
222228
is-release-branch: false
223229
```
224230

@@ -246,8 +252,7 @@ of `alpha.foo` with the value of `alpha.{BranchName}`.
246252
**Note:** To clear a default use an empty string: `tag: ''`
247253

248254
### increment
249-
The part of the SemVer to increment when GitVersion detects it needs to be (i.e
250-
commit after a tag)
255+
Same as for the [global configuration, explained above](#increment).
251256

252257
### prevent-increment-of-merged-branch-version
253258
When `release-2.0.0` is merged into master, we want master to build `2.0.0`. If
@@ -282,11 +287,11 @@ Strategy which will look for tagged merge commits directly off the current
282287
branch. For example `develop` → `release/1.0.0` → merge into `master` and tag
283288
`1.0.0`. The tag is *not* on develop, but develop should be version `1.0.0` now.
284289

285-
### is-develop
290+
### tracks-release-branches
286291
Indicates this branch config represents develop in GitFlow.
287292

288293
### is-release-branch
289294
Indicates this branch config represents a release branch in GitFlow.
290295

291296
### is-mainline
292-
When using Mainline mode, this indicates that this branch is a mainline. By default support/ and master are mainlines.
297+
When using Mainline mode, this indicates that this branch is a mainline. By default support/ and master are mainlines.

docs/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ GitVersion is a tool to help you achieve *Semantic Versioning* on your project.
33

44
This influences many of the decisions GitVersion has made, please read and understand this page as it will help you start using GitVersion effectively!
55

6+
## Compatibility
7+
GitVersion works on Mac, Linux with Mono and Windows.
8+
9+
Tip: If you get `System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux/x86_64/libgit2-baa87df.so`
10+
11+
You likely need to install `libcurl3`. Run `sudo get-get install libcurl3`
12+
613
## Assumptions/Rules
714
### Tags override other rules
815
If a commit is tagged, then GitVersion will *always* use that version over any calculated versions. This is so if you rebuild a tag then the same version will be produced.

docs/more-info/version-sources.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Version Sources
2-
GitVersion has a two step process for calculating the version number, the first is to calculate the base version which is used to then calculate what the next version should be.
2+
GitVersion has a two step process for calculating the version number. First it calculates the base version, which is then used to calculate what the next version should be.
33

44
The logic of GitVersion is something like this:
55

@@ -8,26 +8,38 @@ The logic of GitVersion is something like this:
88
- No: continue
99
- Calculate the base version (highest version from all the sources)
1010
- Increment version if needed based on branch config
11-
- Calculate the build metadata (everything after the +) and append to the calcuated version
11+
- Calculate the build metadata (everything after the +) and append to the calculated version
1212

1313
## Version Sources
14-
### Highest Accessible Tag
15-
GitVersion will find all tags on the current branch and return the highest one.
14+
### Tag name
15+
Returns the version numbers extracted from the current branch's tags.
1616

1717
Will increment: true
1818

1919
### Version in branch name
20-
If the branch has a version in it, then that version will be returned.
20+
Returns the version number from the branch's name.
2121

2222
Will increment: false
2323

2424
### Merge message
25-
If a branch with a version number in it is merged into the current branch, that version number will be used.
25+
Returns the version number of any branch (with a version number in its name) merged into the current branch.
2626

27-
Will increment: false
27+
Will increment: depends on the value of `prevent-increment-of-merged-branch-version`
2828

2929
### GitVersion.yml
30-
If the `next-version` property is specified in the config file, it will be used as a version source.
30+
Returns the value of the `next-version` property in the config file.
31+
32+
Will increment: false
33+
34+
### Develop branch
35+
For the develop branch, i.e. marked with `is-develop: true`
36+
- Returns the version number extracted from any child release-branches, i.e. those marked with `is-release-branch: true`
37+
- Returns the version number of any tags on the master branch
38+
39+
Will increment: true
40+
41+
### Fallback
42+
Returns the version number `0.1.0`.
3143

3244
Will increment: false
3345

docs/usage/command-line.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,7 @@ At the moment only `tag-prefix` option is supported. Read more about [Configurat
6464
It will not change config file 'GitVersion.yml'.
6565

6666
### Example: How to override configuration option 'tag-prefix' to use prefix 'custom'
67-
`GitVersion.exe /output json /overrideconfig tag-prefix=custom`
67+
`GitVersion.exe /output json /overrideconfig tag-prefix=custom`
68+
69+
## Mono
70+
To use on mac or linux, install `mono-complete` then just run `mono GitVersion.exe`

docs/who.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ Various people are actively using GitVersion, and taking advantage of the automa
88
* [Orchestra](https://github.com/wildgums/orchestra)
99
* [Pomona](http://pomona.io/)
1010
* [Shouldly](https://github.com/shouldly/shouldly)
11+
* [Akavache](https://github.com/akavache/akavache)
12+
* [Splat](https://github.com/paulcbetts/splat)
13+
* [ReactiveUI](https://github.com/reactiveui/reactiveui)
1114

1215
If you are using GitVersion in your projects, and you are not listed above, please feel free to add a link to your project.

src/GitVersionCore.Tests/BuildServers/GitLabCiMessageGenerationTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using GitVersionCore.Tests;
66
using NUnit.Framework;
77
using Shouldly;
8+
using System.Reflection;
89

910
[TestFixture]
1011
public class GitLabCiMessageGenerationTests
@@ -29,8 +30,8 @@ public void GenerateMessageTest()
2930
[Test]
3031
public void WriteAllVariablesToTheTextWriter()
3132
{
32-
// this test method writes to disc, hence marked explicit
33-
var f = "this_file_should_be_deleted.properties";
33+
var assemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
34+
var f = Path.Combine(assemblyLocation, "this_file_should_be_deleted.properties");
3435

3536
try
3637
{

0 commit comments

Comments
 (0)