Skip to content

Commit

Permalink
6
Browse files Browse the repository at this point in the history
  • Loading branch information
sonygod committed Oct 9, 2024
1 parent 44369f3 commit 7cf91eb
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,27 @@ jobs:
shell: powershell
run: |
$haxeUrl = "https://haxe.org/download/file/4.3.6/haxe-4.3.6-win64.exe"
$response = Invoke-WebRequest -Uri $haxeUrl -MaximumRedirection 0 -ErrorAction SilentlyContinue
$finalUrl = $response.Headers.Location
Invoke-WebRequest -Uri $finalUrl -OutFile "haxe-install.exe"
try {
# Send the initial request without following redirects
$response = Invoke-WebRequest -Uri $haxeUrl -MaximumRedirection 0 -ErrorAction Stop
} catch [System.Net.WebException] {
if ($_.Response.StatusCode -eq 302) {
# Capture the final URL from the redirect
$finalUrl = $_.Response.Headers["Location"]
if ($finalUrl) {
Write-Host "Resolved final download URL: $finalUrl"
Invoke-WebRequest -Uri $finalUrl -OutFile "haxe-install.exe"
} else {
Write-Host "Failed to resolve final URL."
exit 1
}
} else {
Write-Host "Unexpected error: $($_.Exception.Message)"
exit 1
}
}
- name: Install Haxe 4.3.6
shell: powershell
run: |
Expand Down

0 comments on commit 7cf91eb

Please sign in to comment.