Skip to content

Commit 05d6351

Browse files
committed
Merge pull request #146 from PowerShell/daviwil/release-script-fixes
Update release scripts to handle x86 host binary
2 parents 8580b3d + c9d3cce commit 05d6351

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

scripts/FetchLatestBuild.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ $unpackedPackagesPath = [System.IO.Path]::GetFullPath("$releasePath\UnpackedPack
88
mkdir $releasePath -Force | Out-Null
99

1010
# Install prerequisite packages
11-
#Install-Package -Name "Nito.AsyncEx" -RequiredVersion "3.0.1" -Source "nuget.org" -ProviderName "NuGet" -Destination $buildPath -Force
1211
#Install-Package -Name "Newtonsoft.Json" -RequiredVersion "7.0.1" -Source "nuget.org" -ProviderName "NuGet" -Destination $buildPath -Force
1312

1413
if ($buildVersion -eq $null) {
@@ -20,33 +19,37 @@ if ($buildVersion -eq $null) {
2019
Write-Output "Latest build version on master is $buildVersion`r`n"
2120
}
2221
else {
23-
Write-Error "PowerShellEditorServices build $buildVersion was not successful!" -ErrorAction "Stop"
22+
Write-Error "PowerShellEditorServices build $buildVersion was not successful!" -ErrorAction "Stop"
2423
}
2524
}
2625

2726
function Install-BuildPackage($packageName, $extension) {
2827
$uri = "https://ci.appveyor.com/nuget/powershelleditorservices/api/v2/package/{0}/{1}" -f $packageName.ToLower(), $buildVersion
2928
Write-Verbose "Fetching from URI: $uri"
30-
29+
3130
# Download the package and extract it
3231
$zipPath = "$releasePath\$packageName.zip"
3332
$packageContentPath = "$unpackedPackagesPath\$packageName"
3433
Invoke-WebRequest $uri -OutFile $zipPath -ErrorAction "Stop"
3534
Expand-Archive $zipPath -DestinationPath $packageContentPath -Force -ErrorAction "Stop"
3635
Remove-Item $zipPath -ErrorAction "Stop"
37-
36+
3837
# Copy the binary to the binary signing folder
3938
mkdir $binariesToSignPath -Force | Out-Null
4039
cp "$packageContentPath\lib\net45\$packageName.$extension" -Force -Destination $binariesToSignPath
41-
40+
41+
# Don't forget the x86 exe
42+
if ($extension -eq "exe") {
43+
cp "$packageContentPath\lib\net45\$packageName.x86.$extension" -Force -Destination $binariesToSignPath
44+
}
45+
4246
Write-Output "Extracted package $packageName ($buildVersion)"
4347
}
4448

4549
# Pull the build packages from AppVeyor
4650
Install-BuildPackage "Microsoft.PowerShell.EditorServices" "dll"
4751
Install-BuildPackage "Microsoft.PowerShell.EditorServices.Protocol" "dll"
4852
Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host" "exe"
49-
Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host.x86" "exe"
5053

5154
# Open the BinariesToSign folder
5255
& start $binariesToSignPath

scripts/PackageSignedBinaries.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ mkdir $finalPackagePath -Force | Out-Null
1515
$binaries = Get-ChildItem $binariesToSignPath
1616
foreach ($binaryPath in $binaries) {
1717
$signature = Get-AuthenticodeSignature $binaryPath.FullName
18-
18+
1919
# TODO: More validation here?
2020
if ($signature.Status -eq "NotSigned" -and $FailIfNotSigned) {
2121
Write-Error "Binary file is not authenticode signed: $binaryPath" -ErrorAction Stop
2222
}
23-
24-
# Copy the file back where it belongs
23+
24+
# Get the package name for the binary and account for 32-bit exe
2525
$packageName = [System.IO.Path]::GetFileNameWithoutExtension($binaryPath)
26+
$packageName = $packageName.TrimEnd(".x86")
27+
28+
# Copy the binary back to its package path
2629
$packagePath = "$unpackedPackagesPath\$packageName"
2730
cp $binaryPath.FullName -Destination "$packagePath\lib\net45\" -Force
28-
31+
2932
# Repackage the nupkg with NuGet
3033
Push-Location $finalPackagePath
3134
& $nugetPath pack "$packagePath\$packageName.nuspec"

0 commit comments

Comments
 (0)