From 58f3789fde7525f6bb3675128f1f0cb3e6c0b2d1 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Fri, 23 Apr 2021 17:11:55 -0500 Subject: [PATCH] chore: prepare release keeps newline in changelog The Update-Changelog function of the ChangelogManagement module removes newlines at the end of CHANGELOG.md. A workaround is in place to always add back a newline. The objective is to avoid unnecessary diffs during changelog updates. --- Prepare-Release.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Prepare-Release.ps1 b/Prepare-Release.ps1 index bc45c138..c43df3c5 100644 --- a/Prepare-Release.ps1 +++ b/Prepare-Release.ps1 @@ -5,12 +5,22 @@ param ( $version ) +$ErrorActionPreference = "Stop" + +# Requires: Install-Module -Name ChangelogManagement Update-Changelog -ReleaseVersion $version -LinkMode Automatic -LinkPattern @{ FirstRelease = "https://github.com/rcdailey/trash-updater/releases/tag/v{CUR}" NormalRelease = "https://github.com/rcdailey/trash-updater/compare/v{PREV}...v{CUR}" Unreleased = "https://github.com/rcdailey/trash-updater/compare/v{CUR}...HEAD" } +# Read & Write the file after updating the changelog to force a newline at the end of the file. The +# Update-Changelog method removes the newline at the end. +$content = Get-Content -Path .\CHANGELOG.md +Set-Content -Path .\CHANGELOG.md -Value $content + +# Requires: dotnet tool install -g nbgv nbgv set-version $version + git commit -m "release: v$version" -- CHANGELOG.md version.json git tag -m "release v$version" "v$version"