generated from Stravaig-Projects/stravaig-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-release-notes.ps1
40 lines (28 loc) · 1.43 KB
/
build-release-notes.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$fullVersion = $Env:STRAVAIG_PACKAGE_FULL_VERSION
$currentReleaseNotes = Get-Content "$PSScriptRoot/release-notes/wip-release-notes.md";
for($i = 0; $i -lt $currentReleaseNotes.Length; $i++)
{
$line = $currentReleaseNotes[$i];
if ($line -eq "## Version X")
{
$line = "## Version $fullVersion"
$currentReleaseNotes[$i] = $line;
}
if ($line -eq "Date: ???")
{
$line = "Date: "+(Get-Date).ToString("dddd, d MMMM, yyyy 'at' HH:mm:ss zzzz")
$currentReleaseNotes[$i] = $line;
}
}
Set-Content "$PSScriptRoot/release-notes/release-notes-$fullVersion.md" $currentReleaseNotes -Encoding UTF8 -Force
$fullReleaseNotes = Get-Content "$PSScriptRoot/release-notes/full-release-notes.md";
$preamble = $fullReleaseNotes[0..1];
$currentReleaseNotesExtractLength = $currentReleaseNotes.Length - 1;
$currentReleaseNotesExtract = $currentReleaseNotes[2..$currentReleaseNotesExtractLength]
$existingLength = $fullReleaseNotes.Length - 1;
$existing = $fullReleaseNotes[2..$existingLength];
$fullReleaseNotes = $preamble + $currentReleaseNotesExtract + $existing
Set-Content "$PSScriptRoot/release-notes/full-release-notes.md" $fullReleaseNotes -Encoding UTF8 -Force
$contributors = Get-Content "$PSScriptRoot/contributors.md";
$releaseBody = $currentReleaseNotes + @("", "---", "") + $contributors
Set-Content "$PSScriptRoot/release-body.md" $releaseBody -Encoding UTF8 -Force