Skip to content

Commit 7650b9a

Browse files
committed
ci: improvements to sign output
1 parent c100ab1 commit 7650b9a

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

build/sign.ps1

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,23 @@ function Test-GithubAttestation {
120120
[string]$RepoName
121121
)
122122

123-
Write-Host " 🔐 Verifying attestation for: $FilePath" -ForegroundColor Gray
123+
# Get the parent directory name and the file name
124+
$fileName = (Get-ChildItem $FilePath).Name
125+
126+
Write-Host " 🔐 Verifying attestation for: ..$parentDir\$fileName" -ForegroundColor Gray
124127

125128
try {
126-
# Check if gh CLI is available
127-
if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
128-
throw "GitHub CLI (gh) is not installed or not in PATH"
129-
}
130-
131129
$output = gh attestation verify $FilePath --repo $RepoName 2>&1
132130
if ($LASTEXITCODE -ne 0) {
133131
Write-Host $output -ForegroundColor Red
134132
throw $output # This will trigger the catch block
135133
}
136134

137-
Write-Host "Attestation verified" -ForegroundColor Green
135+
Write-Host "Verified" -ForegroundColor Green
138136
return $true
139137
}
140138
catch {
141-
Write-Host "Attestation verification failed: $_" -ForegroundColor Red
139+
Write-Host "Verification failed: $_" -ForegroundColor Red
142140
return $false
143141
}
144142
}
@@ -241,6 +239,11 @@ function Invoke-NuGetPackageSigning {
241239
}
242240
Write-Host "✓ NuGet found at: $NuGetPath"
243241

242+
if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
243+
throw "GitHub CLI installed or not found in PATH"
244+
}
245+
Write-Host "✓ GitHub CLI found at: $NuGetPath"
246+
244247
# Verify certificate is available and log details
245248
$cert = Get-ChildItem Cert:\CurrentUser\My | Where-Object { $_.Thumbprint -eq $Thumbprint }
246249
if (-not $cert) {
@@ -318,11 +321,16 @@ function Invoke-NuGetPackageSigning {
318321
Sign-SingleFile -FilePath $dll.FullName -Thumbprint $Thumbprint -SignToolPath $SignToolPath -TimestampServer $TimestampServer
319322
}
320323

321-
Write-Host "Repacking signed content..."
324+
Write-Host "Repacking assemblies..."
322325
Get-ChildItem -Path $extractPath -Recurse -Filter "*.nuspec" |
323326
ForEach-Object {
324327
Write-Host " Packing: $($_.Name)"
325-
& $NuGetPath pack $_.FullName -OutputDirectory $directories.Packages
328+
$output = & $NuGetPath pack $_.FullName -OutputDirectory $directories.Packages 2>&1
329+
330+
if ($LASTEXITCODE -ne 0) {
331+
$output | ForEach-Object { Write-Host $_ }
332+
throw "Signing failed for file: $FilePath"
333+
}
326334
}
327335
}
328336

@@ -345,7 +353,13 @@ function Invoke-NuGetPackageSigning {
345353
"-Timestamper", $TimestampServer,
346354
"-NonInteractive"
347355
)
348-
& $NuGetPath @nugetSignParams
356+
357+
$output = & $NuGetPath @nugetSignParams 2>&1
358+
359+
if ($LASTEXITCODE -ne 0) {
360+
$output | ForEach-Object { Write-Host $_ }
361+
throw "Signing failed for file: $FilePath"
362+
}
349363
}
350364

351365
# Print summary of signed packages

0 commit comments

Comments
 (0)