@@ -77,7 +77,13 @@ function Test-RequiredAssets {
77
77
if (-not $found ) {
78
78
throw " Required build asset not found: $ ( $required.Key ) `n This file should contain $ ( $required.Value ) "
79
79
}
80
+
80
81
Write-Host " ✅ Found $ ( $required.Value ) in: $ ( $found.Name ) " - ForegroundColor Green
82
+
83
+ # Verify GitHub attestation
84
+ if (-not (Test-GithubAttestation - FilePath $found.FullName - RepoName " Yubico/Yubico.NET.SDK" )) {
85
+ throw " Attestation verification failed for: $ ( $found.Name ) "
86
+ }
81
87
}
82
88
}
83
89
@@ -109,6 +115,39 @@ function Initialize-DirectoryStructure {
109
115
return $directories
110
116
}
111
117
118
+ function Test-GithubAttestation {
119
+ [CmdletBinding ()]
120
+ param (
121
+ [Parameter (Mandatory = $true )]
122
+ [string ]$FilePath ,
123
+
124
+ [Parameter (Mandatory = $true )]
125
+ [string ]$RepoName
126
+ )
127
+
128
+ Write-Host " 🔐 Verifying attestation for: $FilePath " - ForegroundColor Gray
129
+
130
+ try {
131
+ # Check if gh CLI is available
132
+ if (-not (Get-Command gh - ErrorAction SilentlyContinue)) {
133
+ throw " GitHub CLI (gh) is not installed or not in PATH"
134
+ }
135
+
136
+ $output = gh attestation verify $FilePath -- repo $RepoName 2>&1
137
+ if ($LASTEXITCODE -ne 0 ) {
138
+ Write-Host $output - ForegroundColor Red
139
+ throw $output # This will trigger the catch block
140
+ }
141
+
142
+ Write-Host " ✅ Attestation verified" - ForegroundColor Green
143
+ return $true
144
+ }
145
+ catch {
146
+ Write-Host " ❌ Attestation verification failed: $_ " - ForegroundColor Red
147
+ return $false
148
+ }
149
+ }
150
+
112
151
<#
113
152
. SYNOPSIS
114
153
Signs NuGet and Symbol packages using a smart card certificate.
@@ -196,7 +235,7 @@ function Invoke-NuGetPackageSigning {
196
235
197
236
# Validate tools existence
198
237
Write-Host " `n Verifying required tools..."
199
- if (-not (Test-Path $SignToolPath )) {
238
+ if (-not (Get-Command $SignToolPath - ErrorAction SilentlyContinue )) {
200
239
throw " SignTool not found at path: $SignToolPath "
201
240
}
202
241
Write-Host " ✓ SignTool found at: $SignToolPath "
@@ -254,7 +293,7 @@ function Invoke-NuGetPackageSigning {
254
293
}
255
294
256
295
# First process nupkg files to sign their contents
257
- Write-Host " `n Processing NuGet packages..."
296
+ Write-Host " `n 📦 Processing NuGet packages..." - ForegroundColor Yellow
258
297
$nugetPackages = Get-ChildItem - Path $directories.Unsigned - Filter " *.nupkg"
259
298
foreach ($package in $nugetPackages ) {
260
299
Write-Host " `n Signing contents of: $ ( $package.Name ) "
0 commit comments