Skip to content

ci: fixed bug in sign.ps1 #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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
14 changes: 8 additions & 6 deletions build/sign.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ function Test-RequiredAssets {
}

Write-Host " ✅ Found $($required.Value) in: $($found.Name)" -ForegroundColor Green

# Verify GitHub attestation
if (-not (Test-GithubAttestation -FilePath $found.FullName -RepoName "Yubico/Yubico.NET.SDK")) {
throw "Attestation verification failed for: $($found.Name)"
}
}
}

Expand Down Expand Up @@ -198,6 +193,7 @@ Invoke-NuGetPackageSigning -Thumbprint "0123456789ABCDEF" -WorkingDirectory "C:\
.NOTES
Requires:
- A smart card with the signing certificate
- Github CLI for attestation
- signtool.exe (Windows SDK)
- nuget.exe
- PowerShell 5.1 or later
Expand Down Expand Up @@ -287,6 +283,12 @@ function Invoke-NuGetPackageSigning {
$packages = Get-ChildItem -Path $extractPath -Recurse -Include *.nupkg, *.snupkg
foreach ($package in $packages) {
Write-Host " Copying: $($package.Name)"

# Verify GitHub attestation (that the file has been downloaded from our repo)
if (-not (Test-GithubAttestation -FilePath $package.FullName -RepoName "Yubico/Yubico.NET.SDK")) {
throw "Attestation verification failed for: $($package.Name)"
}

Copy-Item -Path $package.FullName -Destination $directories.Unsigned -Force
}
Write-Host "✓ Copied $($packages.Count) package(s)"
Expand Down Expand Up @@ -325,7 +327,7 @@ function Invoke-NuGetPackageSigning {
}

# Copy symbol packages to output directory
Write-Host "`nCopying symbol packages..."
Write-Host "`nCopying symbol packages..." -ForegroundColor Yellow
$symbolPackages = Get-ChildItem -Path $directories.Unsigned -Filter "*.snupkg"
foreach ($package in $symbolPackages) {
Write-Host " Copying: $($package.Name)"
Expand Down