Skip to content

Update release scripts to handle x86 host binary #146

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
Feb 8, 2016
Merged
Show file tree
Hide file tree
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
15 changes: 9 additions & 6 deletions scripts/FetchLatestBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ $unpackedPackagesPath = [System.IO.Path]::GetFullPath("$releasePath\UnpackedPack
mkdir $releasePath -Force | Out-Null

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

if ($buildVersion -eq $null) {
Expand All @@ -20,33 +19,37 @@ if ($buildVersion -eq $null) {
Write-Output "Latest build version on master is $buildVersion`r`n"
}
else {
Write-Error "PowerShellEditorServices build $buildVersion was not successful!" -ErrorAction "Stop"
Write-Error "PowerShellEditorServices build $buildVersion was not successful!" -ErrorAction "Stop"
}
}

function Install-BuildPackage($packageName, $extension) {
$uri = "https://ci.appveyor.com/nuget/powershelleditorservices/api/v2/package/{0}/{1}" -f $packageName.ToLower(), $buildVersion
Write-Verbose "Fetching from URI: $uri"

# Download the package and extract it
$zipPath = "$releasePath\$packageName.zip"
$packageContentPath = "$unpackedPackagesPath\$packageName"
Invoke-WebRequest $uri -OutFile $zipPath -ErrorAction "Stop"
Expand-Archive $zipPath -DestinationPath $packageContentPath -Force -ErrorAction "Stop"
Remove-Item $zipPath -ErrorAction "Stop"

# Copy the binary to the binary signing folder
mkdir $binariesToSignPath -Force | Out-Null
cp "$packageContentPath\lib\net45\$packageName.$extension" -Force -Destination $binariesToSignPath


# Don't forget the x86 exe
if ($extension -eq "exe") {
cp "$packageContentPath\lib\net45\$packageName.x86.$extension" -Force -Destination $binariesToSignPath
}

Write-Output "Extracted package $packageName ($buildVersion)"
}

# Pull the build packages from AppVeyor
Install-BuildPackage "Microsoft.PowerShell.EditorServices" "dll"
Install-BuildPackage "Microsoft.PowerShell.EditorServices.Protocol" "dll"
Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host" "exe"
Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host.x86" "exe"

# Open the BinariesToSign folder
& start $binariesToSignPath
11 changes: 7 additions & 4 deletions scripts/PackageSignedBinaries.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ mkdir $finalPackagePath -Force | Out-Null
$binaries = Get-ChildItem $binariesToSignPath
foreach ($binaryPath in $binaries) {
$signature = Get-AuthenticodeSignature $binaryPath.FullName

# TODO: More validation here?
if ($signature.Status -eq "NotSigned" -and $FailIfNotSigned) {
Write-Error "Binary file is not authenticode signed: $binaryPath" -ErrorAction Stop
}
# Copy the file back where it belongs

# Get the package name for the binary and account for 32-bit exe
$packageName = [System.IO.Path]::GetFileNameWithoutExtension($binaryPath)
$packageName = $packageName.TrimEnd(".x86")

# Copy the binary back to its package path
$packagePath = "$unpackedPackagesPath\$packageName"
cp $binaryPath.FullName -Destination "$packagePath\lib\net45\" -Force

# Repackage the nupkg with NuGet
Push-Location $finalPackagePath
& $nugetPath pack "$packagePath\$packageName.nuspec"
Expand Down