Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PowerShell/Devolutions.Psign/Devolutions.Psign.psd1
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion nuget/tool/Devolutions.Psign.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ToolCommandName>psign-tool</ToolCommandName>
<PackageId>Devolutions.Psign.Tool</PackageId>

<Version Condition="'$(Version)' == ''">0.5.0</Version>
<Version Condition="'$(Version)' == ''">0.5.1</Version>
<Authors>Devolutions</Authors>
<Description>RID-specific dotnet tool wrapper around prebuilt psign-tool native executables.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
72 changes: 72 additions & 0 deletions scripts/bump-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 `
Expand Down