Skip to content

Commit 5d5e4a6

Browse files
committed
fix: replace Invoke-WebRequest with curl and add robust error handling
1 parent d78f1a3 commit 5d5e4a6

1 file changed

Lines changed: 27 additions & 7 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,33 @@ jobs:
207207

208208
- name: Install Free Pascal Compiler
209209
run: |
210-
# Download and install FPC
211-
Invoke-WebRequest -Uri "https://downloads.sourceforge.net/project/freepascal/Win32/3.2.2/fpc-3.2.2.i386-win32.exe" -OutFile "fpc-installer.exe"
212-
Start-Process -FilePath "fpc-installer.exe" -ArgumentList "/SILENT" -Wait
213-
214-
# Add FPC to PATH
215-
$env:PATH += ";C:\FPC\3.2.2\bin\i386-win32"
216-
echo "C:\FPC\3.2.2\bin\i386-win32" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
210+
# Use curl instead of Invoke-WebRequest (more reliable)
211+
Write-Host "Downloading FPC with curl..."
212+
curl -L -o fpc-installer.exe "https://downloads.sourceforge.net/project/freepascal/Win32/3.2.2/fpc-3.2.2.i386-win32.exe"
213+
214+
# Verify download
215+
if (Test-Path "fpc-installer.exe") {
216+
$fileInfo = Get-Item "fpc-installer.exe"
217+
Write-Host "Downloaded file size: $($fileInfo.Length) bytes"
218+
219+
if ($fileInfo.Length -gt 10MB) {
220+
# Install FPC
221+
Write-Host "Installing FPC..."
222+
Start-Process -FilePath "fpc-installer.exe" -ArgumentList "/SILENT" -Wait
223+
224+
# Add to PATH
225+
echo "C:\FPC\3.2.2\bin\i386-win32" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
226+
Write-Host "FPC installation completed"
227+
} else {
228+
Write-Host "File too small, using Chocolatey..."
229+
choco install freepascal -y
230+
echo "C:\tools\freepascal\bin\i386-win32" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
231+
}
232+
} else {
233+
Write-Host "Download failed, using Chocolatey..."
234+
choco install freepascal -y
235+
echo "C:\tools\freepascal\bin\i386-win32" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
236+
}
217237
218238
- name: Build Windows binary
219239
run: |

0 commit comments

Comments
 (0)