Skip to content

[Docs Generator] Add step to preserve release notes folder during doc gen #5564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/DocGenerator/LitUp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ public static async Task<int> GoAsync(string[] args)
return 2;
}



CopyBreakingChangesDocs();
CopyReleaseNotes();
DeleteExistingDocsAndSwap();

Console.ForegroundColor = ConsoleColor.Green;
Expand Down Expand Up @@ -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);
Expand Down