From c688be3c4e40afbd9fd1f4db7c0efc6695284334 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Wed, 21 Apr 2021 10:51:42 +0100 Subject: [PATCH] Add a step to preverse release notes folder during doc gen (#5564) --- src/DocGenerator/LitUp.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/DocGenerator/LitUp.cs b/src/DocGenerator/LitUp.cs index 88e896d907c..59eafb879d7 100644 --- a/src/DocGenerator/LitUp.cs +++ b/src/DocGenerator/LitUp.cs @@ -99,9 +99,8 @@ public static async Task GoAsync(string[] args) return 2; } - - CopyBreakingChangesDocs(); + CopyReleaseNotes(); DeleteExistingDocsAndSwap(); Console.ForegroundColor = ConsoleColor.Green; @@ -144,6 +143,26 @@ private static void CopyBreakingChangesDocs() } } + private static void CopyReleaseNotes() + { + var outputDir = new DirectoryInfo(Program.OutputDirPath); + var tmpDir = new DirectoryInfo(Program.TmpOutputDirPath); + if (!outputDir.Exists) + throw new Exception($"Docs folder should be present in repos but does not exist at: {Program.OutputDirPath}"); + if (!tmpDir.Exists) + throw new Exception($"Temp docs folder should be present in repos after generation ran but does not exist at: {Program.TmpOutputDirPath}"); + + foreach (var dir in outputDir.EnumerateDirectories()) + { + if (!dir.Name.EndsWith("release-notes")) + continue; + + var newLocation = Path.Combine(tmpDir.FullName, dir.Name); + Console.WriteLine($"Moving {dir.Name} to: {tmpDir.FullName}"); + dir.MoveTo(newLocation); + } + } + private static void DeleteExistingDocsAndSwap() { var outputDir = new DirectoryInfo(Program.OutputDirPath);