From ee423c9f6eea1704017402fa1c0f29bf79fe712c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 31 May 2026 12:15:52 -0400 Subject: [PATCH] Update PowerShell module version bump Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Devolutions.Psign/Devolutions.Psign.psd1 | 2 +- nuget/tool/Devolutions.Psign.Tool.csproj | 2 +- scripts/bump-version.ps1 | 72 +++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/PowerShell/Devolutions.Psign/Devolutions.Psign.psd1 b/PowerShell/Devolutions.Psign/Devolutions.Psign.psd1 index 5d840be..21e12cb 100644 --- a/PowerShell/Devolutions.Psign/Devolutions.Psign.psd1 +++ b/PowerShell/Devolutions.Psign/Devolutions.Psign.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'Devolutions.Psign.psm1' - ModuleVersion = '0.5.0' + ModuleVersion = '0.5.1' GUID = 'e6e50e4b-bf25-4ed6-a343-49f904e79f8f' Author = 'Devolutions' CompanyName = 'Devolutions' diff --git a/nuget/tool/Devolutions.Psign.Tool.csproj b/nuget/tool/Devolutions.Psign.Tool.csproj index 971199f..dfc8b8b 100644 --- a/nuget/tool/Devolutions.Psign.Tool.csproj +++ b/nuget/tool/Devolutions.Psign.Tool.csproj @@ -8,7 +8,7 @@ psign-tool Devolutions.Psign.Tool - 0.5.0 + 0.5.1 Devolutions RID-specific dotnet tool wrapper around prebuilt psign-tool native executables. README.md diff --git a/scripts/bump-version.ps1 b/scripts/bump-version.ps1 index f8c239f..3af38b4 100644 --- a/scripts/bump-version.ps1 +++ b/scripts/bump-version.ps1 @@ -89,6 +89,75 @@ function Update-CargoPackageVersion { } } +function Update-PowerShellModuleManifestVersion { + param( + [Parameter(Mandatory = $true)] + [string]$Path + ) + + if ($Version -notmatch '^(\d+\.\d+\.\d+)([-.](.+))?$') { + throw "Invalid PowerShell module version format: $Version" + } + + $moduleVersion = $Matches[1] + $prerelease = $Matches[3] + + Update-RequiredRegex ` + -Path $Path ` + -Pattern "(?m)^(\s*ModuleVersion\s*=\s*')([^']+)(')" ` + -Description "PowerShell module version" ` + -Replacement { + param($match) + "$($match.Groups[1].Value)$moduleVersion$($match.Groups[3].Value)" + } + + $text = [System.IO.File]::ReadAllText($Path) + if ($prerelease) { + $prereleasePattern = "(?m)^(\s*Prerelease\s*=\s*')([^']*)(')" + if ([regex]::IsMatch($text, $prereleasePattern)) { + Update-RequiredRegex ` + -Path $Path ` + -Pattern $prereleasePattern ` + -Description "PowerShell module prerelease" ` + -Replacement { + param($match) + "$($match.Groups[1].Value)$prerelease$($match.Groups[3].Value)" + } + return + } + + $regex = [regex]::new('(?m)^(\s*)PSData\s*=\s*@\{(\r?\n)') + $script:replaceCount = 0 + $updated = $regex.Replace( + $text, + [System.Text.RegularExpressions.MatchEvaluator] { + param($match) + $script:replaceCount++ + $indent = $match.Groups[1].Value + "$($indent)PSData = @{$($match.Groups[2].Value)$($indent) Prerelease = '$prerelease'$($match.Groups[2].Value)" + }, + 1 + ) + $count = $script:replaceCount + $script:replaceCount = 0 + + if ($count -ne 1) { + throw "Expected exactly one PowerShell module PSData match in $Path; found $count." + } + + Set-FileText -Path $Path -Text $updated + Write-Host "Added PowerShell module prerelease in $Path" + return + } + + $regex = [regex]::new("(?m)^\s*Prerelease\s*=\s*'[^']*'\r?\n?") + $updated = $regex.Replace($text, '', 1) + if ($updated -ne $text) { + Set-FileText -Path $Path -Text $updated + Write-Host "Removed PowerShell module prerelease in $Path" + } +} + $cargoManifests = @((Join-Path $repoRoot "Cargo.toml")) $cratesRoot = Join-Path $repoRoot "crates" if (Test-Path -LiteralPath $cratesRoot) { @@ -101,6 +170,9 @@ foreach ($manifest in $cargoManifests) { Update-CargoPackageVersion -Path $manifest } +$powerShellModuleManifest = Join-Path $repoRoot "PowerShell\Devolutions.Psign\Devolutions.Psign.psd1" +Update-PowerShellModuleManifestVersion -Path $powerShellModuleManifest + $toolProject = Join-Path $repoRoot "nuget\tool\Devolutions.Psign.Tool.csproj" Update-RequiredRegex ` -Path $toolProject `