Skip to content

Instantly share code, notes, and snippets.

@KaiWalter
Created February 17, 2019 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save KaiWalter/e69cfd1d19f56b107acae102484e77d1 to your computer and use it in GitHub Desktop.
Save KaiWalter/e69cfd1d19f56b107acae102484e77d1 to your computer and use it in GitHub Desktop.
download Azure Functions WebHost source code
param(
[string]$DownloadBuildNumber
)
$url = "https://github.com/Azure/azure-functions-host/archive/" + $DownloadBuildNumber + ".zip"
$url2 = "https://github.com/Azure/azure-functions-host/archive/v" + $DownloadBuildNumber + ".zip"
$targetZip = Join-Path $PSScriptRoot "WebHost.zip"
if (Test-Path $targetZip) {
Remove-Item $targetZip -Force
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
try {
Write-Host "Downloading" $url
(New-Object Net.WebClient).DownloadFile($url, $targetZip)
}
catch {
Write-Host "not found on URL" $url
}
if (!(Test-Path $targetZip)) {
try {
Write-Host "Downloading" $url2
(New-Object Net.WebClient).DownloadFile($url2, $targetZip)
}
catch {
Write-Host "not found on URL" $url2
}
}
if (Test-Path $targetZip) {
Expand-Archive $targetZip
Remove-Item $targetZip
$sources = (Get-ChildItem azure-functions-host* -Recurse -Directory)[0]
Move-Item $sources Sources
}
else {
Write-Host "##vso[task.logissue type=error;] URL error"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment