chore: update windows signing script (#12524)

This commit is contained in:
Joshua Powers 2023-01-19 13:35:08 -07:00 committed by GitHub
parent 65b23f112e
commit bfb26a8af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -1,20 +1,17 @@
$tempCertFile = New-TemporaryFile $tempCertFile = New-TemporaryFile
# Retrieve environment variables for cert/password.
$certText = $env:windowsCert $certText = $env:windowsCert
$CertPass = $env:windowsCertPassword
# Create a Cert object by converting the cert string to bytes. # Create a Cert object by converting the cert string to bytes.
$finalFileName = $tempCertFile.FullName $finalFileName = $tempCertFile.FullName
$certBytes = [Convert]::FromBase64String($certText) $certBytes = [Convert]::FromBase64String($certText)
[System.IO.File]::WriteAllBytes($finalFileName, $certBytes) [System.IO.File]::WriteAllBytes($finalFileName, $certBytes)
$CertPath = $finalFileName $CertPath = $finalFileName
$Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertPath, $CertPass) $Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertPath)
# Go through the artifacts directory and sign the 'windows' artifacts. # Go through the artifacts directory and sign the 'windows' artifacts.
$artifactDirectory = "./build/dist" $artifactDirectory = "./build/dist"
$extractDirectory = $artifactDirectory + "\" + "extracted" $extractDirectory = $artifactDirectory + "\" + "extracted"
foreach ($file in get-ChildItem $artifactDirectory | where {$_.name -like "*windows*"} | select name) foreach ($file in get-ChildItem $artifactDirectory | where {$_.name -like "*windows*"} | select name)
{ {
$artifact = $artifactDirectory + "\" + $file.Name $artifact = $artifactDirectory + "\" + $file.Name
Expand-Archive -LiteralPath $artifact -DestinationPath $extractDirectory -Force Expand-Archive -LiteralPath $artifact -DestinationPath $extractDirectory -Force