From 24bad5d24b79708aa09581a16abbe0d74c50fa1a Mon Sep 17 00:00:00 2001 From: Timothy Small Date: Sun, 17 Mar 2024 14:52:28 -0400 Subject: [PATCH] Add pre-release versioning support --- src/Pwsh/Pwsh.csproj | 2 +- src/Pwsh/Update-PwshModuleManifestVersion.ps1 | 8 +++++++- src/TemplateFiles/SmallsOnline.Subnetting.Pwsh.psd1 | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Pwsh/Pwsh.csproj b/src/Pwsh/Pwsh.csproj index d9d4945..76d0be0 100644 --- a/src/Pwsh/Pwsh.csproj +++ b/src/Pwsh/Pwsh.csproj @@ -49,7 +49,7 @@ - + diff --git a/src/Pwsh/Update-PwshModuleManifestVersion.ps1 b/src/Pwsh/Update-PwshModuleManifestVersion.ps1 index 3e32200..630c900 100644 --- a/src/Pwsh/Update-PwshModuleManifestVersion.ps1 +++ b/src/Pwsh/Update-PwshModuleManifestVersion.ps1 @@ -1,7 +1,9 @@ [CmdletBinding()] param( [Parameter(Position = 0)] - [string]$Version + [string]$Version, + [Parameter(Position = 1)] + [string]$PrereleaseVersion ) $outputManifestPath = Join-Path -Path $PSScriptRoot -ChildPath "SmallsOnline.Subnetting.Pwsh.psd1" @@ -10,4 +12,8 @@ $manifest = Get-Content -Path $outputManifestPath -Raw $manifest = $manifest.Replace("{{ VERSION }}", $Version) +if ($null -ne $PrereleaseVersion -and [string]::IsNullOrEmpty($PrereleaseVersion) -eq $false) { + $manifest = $manifest.Replace("{{ PRERELEASE_VERSION }}", $PrereleaseVersion) +} + $manifest | Set-Content -Path $outputManifestPath -Force diff --git a/src/TemplateFiles/SmallsOnline.Subnetting.Pwsh.psd1 b/src/TemplateFiles/SmallsOnline.Subnetting.Pwsh.psd1 index acc020c..a71a02e 100644 --- a/src/TemplateFiles/SmallsOnline.Subnetting.Pwsh.psd1 +++ b/src/TemplateFiles/SmallsOnline.Subnetting.Pwsh.psd1 @@ -112,7 +112,7 @@ # ReleaseNotes = "" # Prerelease string of this module - # Prerelease = "" + Prerelease = "{{ PRERELEASE_VERSION }}" # Flag to indicate whether the module requires explicit user acceptance for install/update/save RequireLicenseAcceptance = $false