Skip to content

Commit

Permalink
Optimize PrepareChangelog build step
Browse files Browse the repository at this point in the history
  • Loading branch information
ImoutoChan committed Oct 29, 2023
1 parent a994dd5 commit ffdaf5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Unreleased

### Infrastructure
* Optimize release notes builder

# 4.19.3

### Room
* Add cancellation support for room controllers
* Add separate query for filter exising file hashes
Expand Down
9 changes: 7 additions & 2 deletions Tools/NukeBuild/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ AbsolutePath[] GetDirectoriesToDelete(string projectName, AbsolutePath projectOu
var changelogTemplateContent = File.ReadAllText(changelogTemplate);

var changelogContent = new StringBuilder();
changelogContent.AppendLine($"# {GitVersion.NuGetVersionV2}");
changelogContent.AppendLine($"## Changes in v{GitVersion.NuGetVersionV2}");
var empty = true;
foreach (var changeLogLine in File.ReadLines(changelog))
{
if (changeLogLine.StartsWith("# Unreleased"))
Expand All @@ -197,10 +198,14 @@ AbsolutePath[] GetDirectoriesToDelete(string projectName, AbsolutePath projectOu
if (changeLogLine.StartsWith("# "))
break;

empty = false;
changelogContent.AppendLine(changeLogLine);
}

var newChangelogContent = empty
? changelogTemplateContent
: changelogTemplateContent + Environment.NewLine + changelogContent;

var newChangelogContent = changelogTemplateContent + Environment.NewLine + changelogContent;
File.WriteAllText(changelogResult, newChangelogContent);
});
}

0 comments on commit ffdaf5d

Please sign in to comment.