|
44 | 44 | run: | |
45 | 45 | Write-Output "::group::Install smctl if needed" |
46 | 46 | if (!(Get-Command smctl -ErrorAction SilentlyContinue)) { |
47 | | - curl -o smtools-windows-x64.msi "https://rstudio-buildtools.s3.amazonaws.com/posit-dev/smtools-windows-x64.msi" |
48 | | - msiexec /i smtools-windows-x64.msi /quiet /qn /log smtools-windows-x64.log |
49 | | - "C:/Program Files/DigiCert/DigiCert One Signing Manager Tools" | Out-File -FilePath $env:GITHUB_PATH -Append |
| 47 | + # Download with retry (transient S3 failures cause silent install failures) |
| 48 | + $maxRetries = 3 |
| 49 | + $downloaded = $false |
| 50 | + for ($i = 1; $i -le $maxRetries; $i++) { |
| 51 | + Write-Output "Downloading smtools MSI (attempt $i/$maxRetries)..." |
| 52 | + curl -o smtools-windows-x64.msi "https://rstudio-buildtools.s3.amazonaws.com/posit-dev/smtools-windows-x64.msi" |
| 53 | + if ($LASTEXITCODE -ne 0) { |
| 54 | + Write-Output "::warning::curl failed with exit code $LASTEXITCODE" |
| 55 | + continue |
| 56 | + } |
| 57 | + $fileSize = (Get-Item smtools-windows-x64.msi).Length |
| 58 | + if ($fileSize -lt 1MB) { |
| 59 | + Write-Output "::warning::Downloaded file is only $fileSize bytes, expected ~90MB" |
| 60 | + continue |
| 61 | + } |
| 62 | + $downloaded = $true |
| 63 | + Write-Output "Download successful ($fileSize bytes)" |
| 64 | + break |
| 65 | + } |
| 66 | + if (-not $downloaded) { |
| 67 | + Write-Output "::error title=Download Error::Failed to download smtools MSI after $maxRetries attempts" |
| 68 | + exit 1 |
| 69 | + } |
| 70 | + # Install synchronously (msiexec can return before install completes without -Wait) |
| 71 | + $process = Start-Process msiexec -ArgumentList '/i', 'smtools-windows-x64.msi', '/quiet', '/qn', '/log', 'smtools-windows-x64.log' -Wait -PassThru |
| 72 | + if ($process.ExitCode -ne 0) { |
| 73 | + Write-Output "::error title=Install Error::msiexec failed with exit code $($process.ExitCode)" |
| 74 | + Get-Content smtools-windows-x64.log -Tail 50 |
| 75 | + exit 1 |
| 76 | + } |
| 77 | + # Verify smctl is actually on disk before declaring success |
| 78 | + $smctlPath = "C:/Program Files/DigiCert/DigiCert One Signing Manager Tools" |
| 79 | + if (!(Test-Path "$smctlPath/smctl.exe")) { |
| 80 | + Write-Output "::error title=Install Error::smctl.exe not found at $smctlPath after install" |
| 81 | + exit 1 |
| 82 | + } |
| 83 | + $smctlPath | Out-File -FilePath $env:GITHUB_PATH -Append |
50 | 84 | Write-Output "SMCTL installed and added on PATH" |
51 | 85 | } else { |
52 | 86 | Write-Output "SMCTL already installed and on PATH" |
|
0 commit comments