Private/Add-KadenChangelogReleaseLine.ps1
|
function Add-KadenChangelogReleaseLine { <# .SYNOPSIS Append the immutable Gallery release line to a changelog file. #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$LiteralPath, [Parameter(Mandatory = $true)] [string]$Tag, [Parameter(Mandatory = $true)] [string]$ModuleVersion ) $line = "Gallery release $Tag publishes immutable module version $ModuleVersion." $existing = '' if (Test-Path -LiteralPath $LiteralPath) { $existing = [System.IO.File]::ReadAllText($LiteralPath) } if ($existing.Length -gt 0 -and -not $existing.EndsWith("`n")) { $existing += "`n" } [System.IO.File]::WriteAllText($LiteralPath, $existing + $line + "`n") } |