diff --git a/appveyor.yml b/appveyor.yml index 122940e24028aa9f56c78d5662f7b992bde2c157..42764e4a8c4fac6a981a4086af47e385dc0433b7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,4 @@ version: 0.8.{build} -pull_requests: - do_not_increment_build_number: true skip_tags: true image: Visual Studio 2017 configuration: Release diff --git a/build.cake b/build.cake index 73ece8c44e76b73ecfdc39b4306eeba3e47259ab..7286010601882fe7a1f250419b66d1354a125594 100644 --- a/build.cake +++ b/build.cake @@ -178,49 +178,48 @@ Task("Potential-Release-Notes") .IsDependentOn("Appveyor-Push-Artifacts") .Does(() => { - string tagHashLastGitHubTag = GitDescribe(".", false, GitDescribeStrategy.Tags, 100); - Information($"Tag and Hash of last release is: {tagHashLastGitHubTag}"); - - if (tagHashLastGitHubTag.Length > 40) - { - string lastReleaseHash = tagHashLastGitHubTag.Substring(tagHashLastGitHubTag.Length - 40); - Information($"Hash of first commit since last release is: {lastReleaseHash}" + Environment.NewLine); + string latestTag = GitDescribe(".", false, GitDescribeStrategy.Tags, 0); + Information($"Latest tag is: {latestTag}" + Environment.NewLine); + + List<GitCommit> relevantCommits = new List<GitCommit>(); - List<GitCommit> relevantCommits = new List<GitCommit>(); + var commitCollection = GitLog("./", 50); - var commitCollection = GitLog("./", 50); - bool foundHash = false; + foreach(GitCommit commit in commitCollection) + { + var commitTag = GitDescribe(".", commit.Sha, false, GitDescribeStrategy.Tags, 0); - foreach(GitCommit commit in commitCollection) + if (commitTag == latestTag) { relevantCommits.Add(commit); - - if (lastReleaseHash == commit.Sha) - { - foundHash = true; - break; - } } - - if (foundHash) + else { - List<string> notesList = new List<string>(); - - foreach(GitCommit commit in relevantCommits.AsEnumerable().Reverse().ToList()) - { - notesList.Add($"{commit.MessageShort} (Thank you @{commit.Author.Name})"); - } + break; + } + } - string buildNote = String.Join(Environment.NewLine, notesList); - Information(buildNote); + relevantCommits = relevantCommits.AsEnumerable().Reverse().Skip(1).ToList(); - FileAppendLines(workingDir + "\\BuildOutput\\ReleaseNotes.txt", notesList.ToArray()); - } - else + if (relevantCommits.Count() > 0) + { + List<string> notesList = new List<string>(); + + foreach(GitCommit commit in relevantCommits) { - Information($"Unable to create potential release notes as the hash ({lastReleaseHash}) of the first commit since the last release wasn't found in the last 50 commits"); + notesList.Add($"{commit.MessageShort} (Thank you @{commit.Author.Name})"); } + + string buildNote = String.Join(Environment.NewLine, notesList); + Information(buildNote); + + FileAppendLines(workingDir + "\\BuildOutput\\ReleaseNotes.txt", notesList.ToArray()); } + else + { + Information($"No commit messages found to create release notes"); + } + });