|
43 | 43 | # so we delete everything that could mess up our builds |
44 | 44 | run: rmdir /S /Q C:\Strawberry |
45 | 45 |
|
46 | | - - name: Install Winget Dependencies from Zip (arm64) |
| 46 | + - name: Install Winget (arm64) |
47 | 47 | if: contains(matrix.arch, 'arm64') |
48 | 48 | run: | |
| 49 | + function Install-AppxWithRetry($path) { |
| 50 | + $maxAttempts = 5 |
| 51 | + for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) { |
| 52 | + try { |
| 53 | + Add-AppxPackage -Path $path -ForceApplicationShutdown -ErrorAction Stop |
| 54 | + return |
| 55 | + } catch { |
| 56 | + if ($attempt -eq $maxAttempts) { |
| 57 | + throw |
| 58 | + } |
| 59 | + Write-Warning "Add-AppxPackage failed (attempt $attempt/$maxAttempts): $($_.Exception.Message)" |
| 60 | + Start-Sleep -Seconds 5 |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | +
|
49 | 65 | $tempDir = Join-Path $env:TEMP "WingetDependencies" |
50 | 66 | $zipFilePath = Join-Path $env:TEMP "DesktopAppInstaller_Dependencies.zip" |
51 | 67 | $archDepsDir = Join-Path $tempDir "${{ matrix.arch }}" # Path to the arm64 or x64 folder inside the unzipped content |
@@ -78,20 +94,16 @@ jobs: |
78 | 94 | } else { |
79 | 95 | foreach ($appxFile in $appXFiles) { |
80 | 96 | Write-Host "Installing $appxFile..." |
81 | | - Add-AppxPackage -Path $appxFile |
| 97 | + Install-AppxWithRetry $appxFile |
82 | 98 | } |
83 | 99 | } |
84 | 100 | } catch { |
85 | 101 | Write-Error "Failed to install AppX packages: $($_.Exception.Message)" |
86 | 102 | exit 1 |
87 | 103 | } |
88 | | - shell: pwsh |
89 | 104 |
|
90 | | - - name: Install Winget (arm64) |
91 | | - if: contains(matrix.arch, 'arm64') |
92 | | - run: | |
93 | 105 | Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.12.460/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile $env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle |
94 | | - Add-AppxPackage $env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle |
| 106 | + Install-AppxWithRetry $env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle |
95 | 107 | shell: pwsh |
96 | 108 |
|
97 | 109 | - name: Install Dependencies |
|
0 commit comments