build/windows: Rely on output (not on error code) on 'msix_trust' check

(cherry picked from commit f890c5ab68)
This commit is contained in:
Bruno Lopes 2025-08-14 22:46:34 -03:00 committed by Jehan
parent 0079ca3db2
commit d57fb16c2d

View file

@ -1,4 +1,4 @@
#!/usr/bin/env pwsh
#!/usr/bin/env pwsh
# Parameters
param ($revision = "$GIMP_CI_MS_STORE",
@ -419,10 +419,10 @@ if (-not $GITLAB_CI -and $wack -eq 'WACK')
if (-not $GIMP_RELEASE -or $GIMP_IS_RC_GIT)
{
Write-Output "$([char]27)[0Ksection_start:$(Get-Date -UFormat %s -Millisecond 0):msix_trust${msix_arch}[collapsed=true]$([char]13)$([char]27)[0KSelf-signing $MSIX_ARTIFACT (for testing purposes)"
signtool sign /debug /fd sha256 /a /f $(Resolve-Path build\windows\store\pseudo-gimp*.pfx) /p eek $MSIX_ARTIFACT
if ("$LASTEXITCODE" -gt '0' -or "$?" -eq 'False')
$sign_output = & signtool sign /debug /fd sha256 /a /f $(Resolve-Path build\windows\store\pseudo-gimp*.pfx) /p eek $MSIX_ARTIFACT
Write-Output $sign_output
if ($sign_output -like "*After expiry filter, 0 certs were left*")
{
## We need to manually check failures in pre-7.4 PS
$pseudo_gimp = "pseudo-gimp_$(Get-Date -UFormat %s -Millisecond 0)"
New-SelfSignedCertificate -Type Custom -Subject "$(([xml](Get-Content build\windows\store\AppxManifest.xml)).Package.Identity.Publisher)" -KeyUsage DigitalSignature -FriendlyName "$pseudo_gimp" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}") | Out-Null
Export-PfxCertificate -Cert "Cert:\CurrentUser\My\$(Get-ChildItem Cert:\CurrentUser\My | Where-Object FriendlyName -EQ "$pseudo_gimp" | Select-Object -ExpandProperty Thumbprint)" -FilePath "${pseudo_gimp}.pfx" -Password (ConvertTo-SecureString -String eek -Force -AsPlainText) | Out-Null