Skip to content

Commit d581977

Browse files
Add a step to preverse release notes folder during doc gen (#5564) (#5568)
Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
1 parent a8895d3 commit d581977

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/DocGenerator/LitUp.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ public static async Task<int> GoAsync(string[] args)
9999
return 2;
100100
}
101101

102-
103-
104102
CopyBreakingChangesDocs();
103+
CopyReleaseNotes();
105104
DeleteExistingDocsAndSwap();
106105

107106
Console.ForegroundColor = ConsoleColor.Green;
@@ -144,6 +143,26 @@ private static void CopyBreakingChangesDocs()
144143
}
145144
}
146145

146+
private static void CopyReleaseNotes()
147+
{
148+
var outputDir = new DirectoryInfo(Program.OutputDirPath);
149+
var tmpDir = new DirectoryInfo(Program.TmpOutputDirPath);
150+
if (!outputDir.Exists)
151+
throw new Exception($"Docs folder should be present in repos but does not exist at: {Program.OutputDirPath}");
152+
if (!tmpDir.Exists)
153+
throw new Exception($"Temp docs folder should be present in repos after generation ran but does not exist at: {Program.TmpOutputDirPath}");
154+
155+
foreach (var dir in outputDir.EnumerateDirectories())
156+
{
157+
if (!dir.Name.EndsWith("release-notes"))
158+
continue;
159+
160+
var newLocation = Path.Combine(tmpDir.FullName, dir.Name);
161+
Console.WriteLine($"Moving {dir.Name} to: {tmpDir.FullName}");
162+
dir.MoveTo(newLocation);
163+
}
164+
}
165+
147166
private static void DeleteExistingDocsAndSwap()
148167
{
149168
var outputDir = new DirectoryInfo(Program.OutputDirPath);

0 commit comments

Comments
 (0)