Skip to content

Commit 855ec8c

Browse files
authored
Merge branch 'master' into bugfix/1808/named-config-exception
2 parents 26beb85 + 54eaa33 commit 855ec8c

File tree

127 files changed

+2358
-1138
lines changed

Some content is hidden

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

127 files changed

+2358
-1138
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ _NCrunch_GitVersion
8585
GitVersion.sln.ide/
8686
.vs/
8787
Packages/
88-
build/
88+
build/*
8989
site/
9090
/TestResult.xml
9191

@@ -123,3 +123,9 @@ src/GitVersionRubyGem/bin/GitVersion.exe
123123
src/GitVersionRubyGem/bin/LibGit2Sharp.dll.config
124124

125125
!**/*.cake
126+
.DS_Store
127+
128+
# Wyam
129+
config.wyam.dll
130+
config.wyam.hash
131+
config.wyam.packages.xml

.markdownlint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"MD026": false
3+
}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2+
"editor.rulers": [80],
23
"cSpell.words": [
34
"commiting",
45
"gittools",
56
"gitversion"
67
]
7-
}
8+
}

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ We use Cake for our build and deployment process. The way the build / release pr
8888
1) We build releasable artifacts on AppVeyor
8989
1) Login to AppVeyor
9090
1) Deploy the latest master build
91-
![docs/img/release-1-deploy.png](docs/img/release-1-deploy.png)
91+
![docs/input/docs/img/release-1-deploy.png](docs/input/docs/img/release-1-deploy.png)
9292
1) Choose GitVersion release, when you press deploy it will create a *non-released* GitHub release, this *will not* create a Git tag. This step is so we can validate the release and release notes before pushing the button.
93-
![docs/img/release-2-deploy.png](docs/img/release-2-deploy.png)
93+
![docs/input/docs/img/release-2-deploy.png](docs/input/docs/img/release-2-deploy.png)
9494
1) All the artifacts should upload nicely
95-
![docs/img/release-3-deploy.png](docs/img/release-3-deploy.png)
95+
![docs/input/docs/img/release-3-deploy.png](docs/input/docs/img/release-3-deploy.png)
9696
1) Head over to GitHub releases, you should have a draft release, download a copy of the release notes
97-
![docs/img/release-4-deploy.png](docs/img/release-4-deploy.png)
97+
![docs/input/docs/img/release-4-deploy.png](docs/input/docs/img/release-4-deploy.png)
9898
1) Edit the release and do the following:
9999
1. Remove the build metadata from the tag and title (the + and everything after it)
100100
2. Paste the downloaded release notes in, you can clean them up if you want otherwise there may be closed issues which were questions etc.

README.md

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h1>
2-
<img src="docs/img/package_icon.svg" alt="Tree" height="100">
2+
<img src="docs/input/docs/img/package_icon.svg" alt="Tree" height="100">
33
GitVersion
44
</h1>
55

@@ -14,7 +14,6 @@ works out the [semantic version][semver] of the commit being built.
1414

1515
| | Stable | Pre-release |
1616
| ------------------------------------: | :----------------------------------------------------------------: | :------------------------------------------------------------------------: |
17-
| **Docs** | [![Docs][docs-badge]][docs] | [![Docs][docs-pre-badge]][docs-pre] |
1817
| **GitHub Release** | [![GitHub release][gh-rel-badge]][gh-rel] | - |
1918
| **GitVersion.Portable** | [![Chocolatey][choco-badge]][choco] | [![Chocolatey][choco-pre-badge]][choco] |
2019
| **GitVersionTask** | [![NuGet][gvt-badge]][gvt] | [![NuGet][gvt-pre-badge]][gvt] |
@@ -23,7 +22,7 @@ works out the [semantic version][semver] of the commit being built.
2322
| **Gem** | [![Gem][gem-badge]][gem] | - |
2423
| **Homebrew** | [![homebrew][brew-badge]][brew] | - |
2524
| **Docker** | [![Docker Pulls][dockerhub-badge]][dockerhub] | - |
26-
| **Azure Pipeline Task** | [![Azure Pipeline Task][az-pipeline-task-badge]][az-pipeline-task] | [![Azure Pipeline Task][az-pipeline-task-pre-badge]][az-pipeline-task-pre] |
25+
| **Azure Pipeline Task** | [![Azure Pipeline Task][az-pipeline-task-badge]][az-pipeline-task] | - |
2726
| **Github Action** | [![Github Action][gh-actions-badge]][gh-actions] | - |
2827

2928
## Compatibility
@@ -74,40 +73,35 @@ from The Noun Project.
7473
[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=master
7574
[codecov]: https://codecov.io/gh/GitTools/GitVersion
7675
[codecov-badge]: https://codecov.io/gh/GitTools/GitVersion/branch/master/graph/badge.svg
77-
[docs]: http://gitversion.readthedocs.org/en/stable/
78-
[docs-badge]: https://readthedocs.org/projects/gitversion/badge/?version=stable
79-
[docs-pre]: http://gitversion.readthedocs.org/en/latest/
80-
[docs-pre-badge]: https://readthedocs.org/projects/gitversion/badge/?version=latest
76+
[docs]: https://gitversion.net/docs/
8177
[gh-rel]: https://github.com/GitTools/GitVersion/releases/latest
82-
[gh-rel-badge]: https://img.shields.io/github/release/gittools/gitversion.svg
78+
[gh-rel-badge]: https://img.shields.io/github/release/gittools/gitversion.svg?logo=github
8379
[choco]: https://chocolatey.org/packages/GitVersion.Portable
84-
[choco-badge]: https://img.shields.io/chocolatey/v/gitversion.portable.svg
85-
[choco-pre-badge]: https://img.shields.io/chocolatey/vpre/gitversion.portable.svg
80+
[choco-badge]: https://img.shields.io/chocolatey/v/gitversion.portable.svg?logo=nuget
81+
[choco-pre-badge]: https://img.shields.io/chocolatey/vpre/gitversion.portable.svg?logo=nuget
8682
[gvt]: https://www.nuget.org/packages/GitVersionTask
87-
[gvt-badge]: https://img.shields.io/nuget/v/GitVersionTask.svg
88-
[gvt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersionTask.svg
83+
[gvt-badge]: https://img.shields.io/nuget/v/GitVersionTask.svg?logo=nuget
84+
[gvt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersionTask.svg?logo=nuget
8985
[gvcl]: https://www.nuget.org/packages/GitVersion.CommandLine
90-
[gvcl-badge]: https://img.shields.io/nuget/v/GitVersion.CommandLine.svg
91-
[gvcl-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.CommandLine.svg
86+
[gvcl-badge]: https://img.shields.io/nuget/v/GitVersion.CommandLine.svg?logo=nuget
87+
[gvcl-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.CommandLine.svg?logo=nuget
9288
[gvgt]: https://www.nuget.org/packages/GitVersion.Tool
93-
[gvgt-badge]: https://img.shields.io/nuget/v/GitVersion.Tool.svg
94-
[gvgt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.Tool.svg
95-
[gem-badge]: https://img.shields.io/gem/v/gitversion.svg
89+
[gvgt-badge]: https://img.shields.io/nuget/v/GitVersion.Tool.svg?logo=nuget
90+
[gvgt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.Tool.svg?logo=nuget
91+
[gem-badge]: https://img.shields.io/gem/v/gitversion.svg?logo=ruby
9692
[gem]: https://rubygems.org/gems/gitversion
9793
[brew]: http://brew.sh/
98-
[brew-badge]: https://img.shields.io/homebrew/v/gitversion.svg
99-
[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md
100-
[why]: http://gitversion.readthedocs.org/en/latest/why
101-
[usage]: http://gitversion.readthedocs.org/en/latest/usage/usage/
102-
[how]: http://gitversion.readthedocs.org/en/latest/more-info/how-it-works/
103-
[faq]: http://gitversion.readthedocs.org/en/latest/faq/
104-
[who]: http://gitversion.readthedocs.org/en/latest/who/
105-
[gv-in-action]: https://raw.github.com/GitTools/GitVersion/master/docs/img/README.png
94+
[brew-badge]: https://img.shields.io/homebrew/v/gitversion.svg?logo=homebrew
10695
[dockerhub]: https://hub.docker.com/r/gittools/gitversion/
107-
[dockerhub-badge]: https://img.shields.io/docker/pulls/gittools/gitversion.svg
108-
[az-pipeline-task]: https://marketplace.visualstudio.com/items?itemName=GitTools.usegitversion
109-
[az-pipeline-task-badge]: https://img.shields.io/visual-studio-marketplace/v/GitTools.usegitversion.svg?label=vsix
110-
[az-pipeline-task-pre]: https://marketplace.visualstudio.com/items?itemName=GitTools.usegitversion-preview
111-
[az-pipeline-task-pre-badge]: https://img.shields.io/visual-studio-marketplace/v/GitTools.usegitversion-preview.svg?label=vsix
112-
[gh-actions]: https://github.com/marketplace/actions/use-gitversion
113-
[gh-actions-badge]: https://img.shields.io/badge/marketplace-use--gitversion-blue?logo=github&style=flat-square
96+
[dockerhub-badge]: https://img.shields.io/docker/pulls/gittools/gitversion.svg?logo=docker
97+
[az-pipeline-task]: https://marketplace.visualstudio.com/items?itemName=gittools.gittools
98+
[az-pipeline-task-badge]: https://img.shields.io/badge/marketplace-gittools.gittools-blue?logo=visual-studio
99+
[gh-actions]: https://github.com/marketplace/actions/use-actions
100+
[gh-actions-badge]: https://img.shields.io/badge/marketplace-use--actions-blue?logo=github
101+
[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md
102+
[why]: https://gitversion.net/docs/why
103+
[usage]: https://gitversion.net/docs/usage/usage
104+
[how]: https://gitversion.net/docs/more-info/how-it-works
105+
[faq]: https://gitversion.net/docs/faq
106+
[who]: https://gitversion.net/docs/who
107+
[gv-in-action]: https://raw.github.com/GitTools/GitVersion/master/docs/input/docs/img/README.png

build.cake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
#addin "nuget:?package=Cake.Coverlet&version=2.3.4"
88
#addin "nuget:?package=Cake.Docker&version=0.10.1"
99
#addin "nuget:?package=Cake.Gem&version=0.8.1"
10+
#addin "nuget:?package=Cake.Git&version=0.21.0"
1011
#addin "nuget:?package=Cake.Gitter&version=0.11.1"
1112
#addin "nuget:?package=Cake.Incubator&version=5.1.0"
1213
#addin "nuget:?package=Cake.Json&version=4.0.0"
14+
#addin "nuget:?package=Cake.Kudu&version=0.10.1"
1315
#addin "nuget:?package=Cake.Npm&version=0.17.0"
1416
#addin "nuget:?package=Cake.Tfx&version=0.9.1"
17+
#addin "nuget:?package=Cake.Wyam&version=2.2.9"
1518

1619
#addin "nuget:?package=Newtonsoft.Json&version=12.0.2"
1720
#addin "nuget:?package=SharpZipLib&version=1.2.0"
@@ -20,6 +23,8 @@
2023
// Install tools.
2124
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.10.0"
2225
#tool "nuget:?package=nuget.commandline&version=5.2.0"
26+
#tool "nuget:?package=Wyam&version=2.2.9"
27+
#tool "nuget:?package=KuduSync.NET&version=1.5.2"
2328

2429
// Install .NET Core Global tools.
2530
#tool "dotnet:?package=Codecov.Tool&version=1.7.2"
@@ -34,6 +39,7 @@
3439
#load "./build/artifacts-test.cake"
3540
#load "./build/docker.cake"
3641
#load "./build/publish.cake"
42+
#load "./build/wyam.cake"
3743

3844
using Xunit;
3945
using System.Diagnostics;
@@ -140,6 +146,7 @@ Task("Publish")
140146
.IsDependentOn("Publish-NuGet")
141147
.IsDependentOn("Publish-Chocolatey")
142148
.IsDependentOn("Publish-Gem")
149+
.IsDependentOn("Publish-Documentation")
143150
.Finally(() =>
144151
{
145152
if (publishingError)

build/stages/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ steps:
2626
ENABLED_PUBLISH_TFS: $(ENABLED_PUBLISH_TFS)
2727
ENABLED_PUBLISH_NUGET: $(ENABLED_PUBLISH_NUGET)
2828
ENABLED_PUBLISH_CHOCOLATEY: $(ENABLED_PUBLISH_CHOCOLATEY)
29+
DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2

build/utils/paths.cake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class BuildPaths
2525

2626
var semVersion = version.SemVersion;
2727

28+
var sourceDir = (DirectoryPath)(context.Directory("./src"));
2829
var artifactsDir = (DirectoryPath)(context.Directory("./artifacts") + context.Directory("v" + semVersion));
2930
var artifactsBinDir = artifactsDir.Combine("bin");
3031
var artifactsBinPortableDir = artifactsBinDir.Combine("portable");
@@ -42,6 +43,7 @@ public class BuildPaths
4243

4344
// Directories
4445
var buildDirectories = new BuildDirectories(
46+
sourceDir,
4547
artifactsDir,
4648
nativeDir,
4749
buildArtifactDir,
@@ -86,6 +88,7 @@ public class BuildFiles
8688

8789
public class BuildDirectories
8890
{
91+
public DirectoryPath Source { get; private set; }
8992
public DirectoryPath Artifacts { get; private set; }
9093
public DirectoryPath Native { get; private set; }
9194
public DirectoryPath NugetRoot { get; private set; }
@@ -100,6 +103,7 @@ public class BuildDirectories
100103
public ICollection<DirectoryPath> ToClean { get; private set; }
101104

102105
public BuildDirectories(
106+
DirectoryPath sourceDir,
103107
DirectoryPath artifactsDir,
104108
DirectoryPath nativeDir,
105109
DirectoryPath buildArtifactDir,
@@ -113,6 +117,7 @@ public class BuildDirectories
113117
DirectoryPath artifactsBinFullFx472Dir
114118
)
115119
{
120+
Source = sourceDir;
116121
Artifacts = artifactsDir;
117122
Native = nativeDir;
118123
BuildArtifact = buildArtifactDir;

build/wyam.cake

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
Task("Clean-Documentation")
2+
.Does(() =>
3+
{
4+
EnsureDirectoryExists(MakeAbsolute(Directory("artifacts/temp/_PublishedDocumentation")));
5+
});
6+
7+
Task("Preview-Documentation")
8+
.WithCriteria(() => DirectoryExists(MakeAbsolute(Directory("docs"))), "Wyam documentation directory is missing")
9+
.Does<BuildParameters>((parameters) =>
10+
{
11+
Wyam(new WyamSettings
12+
{
13+
Recipe = "Docs",
14+
Theme = "Samson",
15+
OutputPath = MakeAbsolute(Directory("artifacts/Documentation")),
16+
RootPath = MakeAbsolute(Directory("docs")),
17+
Preview = true,
18+
Watch = true,
19+
ConfigurationFile = MakeAbsolute((FilePath)"config.wyam"),
20+
Settings = new Dictionary<string, object>
21+
{
22+
{ "Host", "gittools.github.io" },
23+
{ "BaseEditUrl", "https://github.com/gittools/GitVersion/tree/master/docs/input/" },
24+
{ "SourceFiles", MakeAbsolute(parameters.Paths.Directories.Source) + "/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs" },
25+
{ "Title", "GitVersion" },
26+
{ "IncludeGlobalNamespace", false }
27+
}
28+
});
29+
});
30+
31+
Task("Force-Publish-Documentation")
32+
.IsDependentOn("Clean-Documentation")
33+
.WithCriteria(() => DirectoryExists(MakeAbsolute(Directory("docs"))), "Wyam documentation directory is missing")
34+
.Does<BuildParameters>((parameters) =>
35+
{
36+
Wyam(new WyamSettings
37+
{
38+
Recipe = "Docs",
39+
Theme = "Samson",
40+
OutputPath = MakeAbsolute(Directory("artifacts/Documentation")),
41+
RootPath = MakeAbsolute(Directory("docs")),
42+
ConfigurationFile = MakeAbsolute((FilePath)"config.wyam"),
43+
Settings = new Dictionary<string, object>
44+
{
45+
{ "BaseEditUrl", "https://github.com/gittools/GitVersion/tree/master/docs/input/" },
46+
{ "SourceFiles", MakeAbsolute(parameters.Paths.Directories.Source) + "/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs" },
47+
{ "Title", "GitVersion" },
48+
{ "IncludeGlobalNamespace", false }
49+
}
50+
});
51+
52+
PublishDocumentation(parameters);
53+
});
54+
55+
Task("Publish-Documentation")
56+
.IsDependentOn("Clean-Documentation")
57+
.WithCriteria(() => DirectoryExists(MakeAbsolute(Directory("docs"))), "Wyam documentation directory is missing")
58+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Publish-Documentation is ran only on Windows agents.")
59+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnAzurePipeline, "Publish-Documentation is ran only on AzurePipeline.")
60+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsPullRequest, "Publish-Documentation works only for non-PR commits.")
61+
.Does<BuildParameters>((parameters) =>
62+
{
63+
// Check to see if any documentation has changed
64+
var sourceCommit = GitLogTip("./");
65+
Information("Source Commit Sha: {0}", sourceCommit.Sha);
66+
var filesChanged = GitDiff("./", sourceCommit.Sha);
67+
Information("Number of changed files: {0}", filesChanged.Count);
68+
var docFileChanged = false;
69+
70+
var wyamDocsFolderDirectoryName = "docs";
71+
72+
foreach (var file in filesChanged)
73+
{
74+
var forwardSlash = '/';
75+
Verbose("Changed File OldPath: {0}, Path: {1}", file.OldPath, file.Path);
76+
if (file.OldPath.Contains(string.Format("{0}{1}", wyamDocsFolderDirectoryName, forwardSlash)) ||
77+
file.Path.Contains(string.Format("{0}{1}", wyamDocsFolderDirectoryName, forwardSlash)) ||
78+
file.Path.Contains("config.wyam"))
79+
{
80+
docFileChanged = true;
81+
break;
82+
}
83+
}
84+
85+
if (docFileChanged)
86+
{
87+
Information("Detected that documentation files have changed, so running Wyam...");
88+
89+
Wyam(new WyamSettings
90+
{
91+
Recipe = "Docs",
92+
Theme = "Samson",
93+
OutputPath = MakeAbsolute(Directory("artifacts/Documentation")),
94+
RootPath = MakeAbsolute(Directory("docs")),
95+
ConfigurationFile = MakeAbsolute((FilePath)"config.wyam"),
96+
Settings = new Dictionary<string, object>
97+
{
98+
{ "BaseEditUrl", "https://github.com/gittools/GitVersion/tree/master/docs/input/" },
99+
{ "SourceFiles", MakeAbsolute(parameters.Paths.Directories.Source) + "/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs" },
100+
{ "Title", "GitVersion" },
101+
{ "IncludeGlobalNamespace", false }
102+
}
103+
});
104+
105+
PublishDocumentation(parameters);
106+
}
107+
else
108+
{
109+
Information("No documentation has changed, so no need to generate documentation");
110+
}
111+
})
112+
.OnError(exception =>
113+
{
114+
Error(exception.Message);
115+
Information("Publish-Documentation Task failed, but continuing with next Task...");
116+
publishingError = true;
117+
});
118+
119+
public void PublishDocumentation(BuildParameters parameters)
120+
{
121+
var sourceCommit = GitLogTip("./");
122+
123+
var publishFolder = MakeAbsolute(Directory("artifacts/temp/_PublishedDocumentation")).Combine(DateTime.Now.ToString("yyyyMMdd_HHmmss"));
124+
Information("Publishing Folder: {0}", publishFolder);
125+
Information("Getting publish branch...");
126+
GitClone("https://github.com/gittools/GitVersion", publishFolder, new GitCloneSettings{ BranchName = "gh-pages" });
127+
128+
Information("Sync output files...");
129+
Kudu.Sync(MakeAbsolute(Directory("artifacts/Documentation")), publishFolder, new KuduSyncSettings {
130+
ArgumentCustomization = args=>args.Append("--ignore").AppendQuoted(".git;CNAME")
131+
});
132+
133+
if (GitHasUncommitedChanges(publishFolder))
134+
{
135+
Information("Stage all changes...");
136+
GitAddAll(publishFolder);
137+
138+
if (GitHasStagedChanges(publishFolder))
139+
{
140+
Information("Commit all changes...");
141+
GitCommit(
142+
publishFolder,
143+
sourceCommit.Committer.Name,
144+
sourceCommit.Committer.Email,
145+
string.Format("Continuous Integration Publish: {0}\r\n{1}", sourceCommit.Sha, sourceCommit.Message)
146+
);
147+
148+
Information("Pushing all changes...");
149+
GitPush(publishFolder, parameters.Credentials.GitHub.Token, "x-oauth-basic", "gh-pages");
150+
}
151+
}
152+
}

config.wyam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pipelines["RenderPages"].Replace("WriteMetadata", new Headings(2));

0 commit comments

Comments
 (0)