File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ github : [OpenByteDev]
Original file line number Diff line number Diff line change @@ -4,13 +4,25 @@ $headers = @{
44}
55$releases = Invoke-RestMethod - Uri " https://api.github.com/repos/dotnet/cli-lab/releases/latest" - Headers $headers
66$asset = $releases.assets | Where-Object { $_.name -eq " dotnet-core-uninstall.msi" } | Select-Object - First 1
7+
8+ # Check if the asset is missing
9+ if (-not $asset ) {
10+ throw " Release asset 'dotnet-core-uninstall.msi' was not found in the latest release."
11+ }
12+ if (-not $asset.browser_download_url ) {
13+ throw " Release asset 'dotnet-core-uninstall.msi' does not have a browser_download_url."
14+ }
15+
716$url = $asset.browser_download_url
817Invoke-WebRequest - Uri $url - OutFile $ (Split-Path $url - Leaf)
918
1019# Prepare uninstall tool
11- $extractPath = Join-Path $pwd " dotnet-core-uninstall" # needs to be a new path
20+ $extractPath = Join-Path $pwd " dotnet-core-uninstall"
21+
22+ # Run msiexec
1223msiexec.exe / A dotnet- core- uninstall.msi TARGETDIR= $extractPath / QN / L* V log.txt
13- $uninstallToolPath = Join-Path $extractPath " dotnet-core-uninstall" " dotnet-core-uninstall.exe"
24+ $uninstallToolPath = Join-Path $extractPath " PFiles" " dotnet-core-uninstall" " dotnet-core-uninstall.exe"
25+
1426# wait for the tool to be ready
1527$maxRetries = 30
1628$retry = 0
@@ -19,8 +31,8 @@ while (-not (Test-Path $uninstallToolPath) -and ($retry -lt $maxRetries)) {
1931 $retry ++
2032}
2133if ($retry -eq $maxRetries ) {
22- Write-Error " Uninstall tool was not found after $maxRetries seconds."
23- Get-Content - Path " log.txt" | Write-Host
34+ Write-Host " Uninstall tool was not found after $maxRetries seconds."
35+ if ( Test-Path " log.txt " ) { Get-Content - Path " log.txt" | Write-Host }
2436 exit 1
2537}
2638
Original file line number Diff line number Diff line change 1313 rerun_if_uninstall_dotnet_failed :
1414 if : >
1515 github.event.workflow_run.conclusion == 'failure' &&
16- github.event.workflow_run.run_attempt < 5
16+ github.event.workflow_run.run_attempt < 3
1717 runs-on : ubuntu-latest
1818
1919 steps :
You can’t perform that action at this time.
0 commit comments