forked from ni/labview-icon-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateReleaseNotes.ps1
More file actions
26 lines (24 loc) · 830 Bytes
/
Copy pathGenerateReleaseNotes.ps1
File metadata and controls
26 lines (24 loc) · 830 Bytes
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
param(
[string]$OutputPath = "Tooling/deployment/release_notes.md"
)
# Ensure git history is available
git fetch --tags --unshallow 2>$null | Out-Null
$latestTag = git describe --tags --abbrev=0 2>$null
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($latestTag)) {
$log = git log --pretty=format:'- %s (%h)' --no-merges
} else {
$log = git log "$latestTag..HEAD" --pretty=format:'- %s (%h)' --no-merges
}
if (-not $log) {
$log = "- Initial release"
} else {
$log = $log -join "`n"
}
$notes = "# Release Notes`n`n$log`n"
$fullPath = Join-Path (Get-Location) $OutputPath
$directory = Split-Path $fullPath
if (-not (Test-Path $directory)) {
New-Item -ItemType Directory -Path $directory -Force | Out-Null
}
Set-Content -Path $fullPath -Value $notes
Write-Host "Release notes written to $fullPath"