mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-08-09 03:39:28 +08:00
[ci] add SignPath Windows test signing
This commit is contained in:
@@ -26,12 +26,40 @@ function Normalize-AppVersion {
|
||||
return $InputVersion
|
||||
}
|
||||
|
||||
function Convert-To-WindowsVersion {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$InputVersion
|
||||
)
|
||||
|
||||
$body = $InputVersion -replace '^v', ''
|
||||
$baseMatch = [regex]::Match($body, '^[0-9]+(?:\.[0-9]+){0,3}')
|
||||
if (!$baseMatch.Success) {
|
||||
return "0.0.0.0"
|
||||
}
|
||||
|
||||
$parts = [System.Collections.Generic.List[int]]::new()
|
||||
foreach ($part in $baseMatch.Value.Split('.')) {
|
||||
$value = [int]$part
|
||||
if ($value -gt 65535) {
|
||||
$value = 0
|
||||
}
|
||||
$parts.Add($value)
|
||||
}
|
||||
while ($parts.Count -lt 4) {
|
||||
$parts.Add(0)
|
||||
}
|
||||
|
||||
return ($parts -join '.')
|
||||
}
|
||||
|
||||
$normalizedVersion = Normalize-AppVersion -InputVersion $Version
|
||||
$windowsVersion = Convert-To-WindowsVersion -InputVersion $normalizedVersion
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
|
||||
Push-Location $scriptDir
|
||||
try {
|
||||
& makensis "/DVERSION=$normalizedVersion" "nsis_script.nsi"
|
||||
& makensis "/DVERSION=$normalizedVersion" "/DVERSION_NUMERIC=$windowsVersion" "nsis_script.nsi"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user