Skip to content

Commit

Permalink
chore(build): detect latest binaries for Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed May 20, 2018
1 parent c45d3cc commit d76745c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion appveyor.yml
Expand Up @@ -13,7 +13,6 @@ clone_folder: c:\gopath\src\github.com\pact-foundation\pact-go
environment:
GOPATH: c:\gopath
GOVERSION: 1.10
PACT_INTEGRATED_TESTS: 1
PACT_BROKER_HOST: "https://test.pact.dius.com.au"
PACT_BROKER_USERNAME: "dXfltyFMgNOFZAxr8io9wJ37iUpY42M"
PACT_BROKER_PASSWORD: "O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1"
Expand Down
20 changes: 10 additions & 10 deletions scripts/pact.ps1
@@ -1,10 +1,6 @@
$pactDir = "$env:APPVEYOR_BUILD_FOLDER\pact"
$exitCode = 0

if ($env:PACT_INTEGRATED_TESTS) {
Remove-Item env:\PACT_INTEGRATED_TESTS
}

# Set environment
if (!($env:GOPATH)) {
$env:GOPATH = "c:\go"
Expand All @@ -21,18 +17,22 @@ if (Test-Path "$pactDir") {
Write-Host "--> Creating ${pactDir}"
New-Item -Force -ItemType Directory $pactDir

Write-Host "--> Downloading Ruby binaries)"
Write-Host "--> Downloading Latest Ruby binaries)"
$downloadDir = $env:TEMP
$version = Get-Contents "./"
$url = "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.33.1/pact-1.33.1-win32.zip"
$latestRelease = Invoke-WebRequest https://github.com/pact-foundation/pact-ruby-standalone/releases/latest -Headers @{"Accept"="application/json"}
$json = $latestRelease.Content | ConvertFrom-Json
$latestVersion = $json.tag_name
$url = "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v$latestVersion/pact-$latestVersion-win32.zip"

Write-Host " Downloading $url"
$zip = "$downloadDir\pact.zip"
if (!(Test-Path "$zip")) {
$downloader = new-object System.Net.WebClient
$downloader.DownloadFile($url, $zip)
if (Test-Path "$zip") {
Remove-Item $zip
}

$downloader = new-object System.Net.WebClient
$downloader.DownloadFile($url, $zip)

Write-Host " Extracting $zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory("$zip", $pactDir)
Expand Down

0 comments on commit d76745c

Please sign in to comment.