chore: Update Windows zip archive creation (#14015)
This commit is contained in:
parent
d07701f35f
commit
0deb3d5047
|
|
@ -11,16 +11,20 @@ $certBytes = [Convert]::FromBase64String($certText)
|
||||||
$CertPath = $finalFileName
|
$CertPath = $finalFileName
|
||||||
$Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertPath, $CertPass)
|
$Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertPath, $CertPass)
|
||||||
|
|
||||||
|
# Update the version of Compress-Archive to support zipping correctly.
|
||||||
|
Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force
|
||||||
|
Import-Module Microsoft.PowerShell.Archive
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
$subDirectoryPath = $extractDirectory + "\" + (Get-ChildItem -Path $extractDirectory | Select-Object -First 1).Name
|
$subDirectoryPath = $extractDirectory + "/" + (Get-ChildItem -Path $extractDirectory | Select-Object -First 1).Name
|
||||||
$telegrafExePath = $subDirectoryPath + "\" + "telegraf.exe"
|
$telegrafExePath = $subDirectoryPath + "/" + "telegraf.exe"
|
||||||
Set-AuthenticodeSignature -Certificate $Cert -FilePath $telegrafExePath -TimestampServer http://timestamp.digicert.com
|
Set-AuthenticodeSignature -Certificate $Cert -FilePath $telegrafExePath -TimestampServer http://timestamp.digicert.com
|
||||||
Compress-Archive -Path $subDirectoryPath -DestinationPath $artifact -Force
|
Compress-Archive -Path $subDirectoryPath -DestinationPath $artifact -Force
|
||||||
Remove-Item $extractDirectory -Force -Recurse
|
Remove-Item $extractDirectory -Force -Recurse
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue