Skip to content

Commit 8a9ae45

Browse files
committed
(GitToolsGH-1088) Control when attempt is made to upload releasenotes.md
- Only do this when on the master branch of main GitVersion repo, and when it is NOT a PullRequest - Ensure that releasenotes.md exists prior to attempting upload
1 parent e395f66 commit 8a9ae45

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

0 commit comments

Comments
 (0)