Skip to content

Commit 8e4876a

Browse files
authored
GHA: add the ability to upload install logs on failure
Attempt to enable logging on installation. If the installation fails, this allows us to upload logs so that we can perform diagnostics on why the install may have failed.
1 parent 17be5ca commit 8e4876a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ runs:
7474
shell: pwsh
7575

7676
- name: Install Swift ${{ inputs.tag }}
77+
id: install-swift
7778
if: runner.os == 'Windows'
7879
run: |
7980
$Installer = [IO.Path]::Combine(${env:Temp}, "installer.exe")
80-
$Arguments = "/quiet ${{ inputs.installer-args }}".Split(" ", [StringSplitOptions]"RemoveEmptyEntries")
81+
$Arguments = "/quiet /lv*x ${env:Temp}/install.log ${{ inputs.installer-args }}".Split(" ", [StringSplitOptions]"RemoveEmptyEntries")
8182
8283
Write-Host "::debug::Installer Arguments: $($Arguments -join ' ')"
8384
try {
@@ -110,6 +111,13 @@ runs:
110111
Get-ChildItem Env: | ForEach-Object { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append }
111112
shell: pwsh
112113

114+
- name: Upload Error Logs
115+
if: runner.os == 'Windows' && failure() && steps.install-swift.outcome == 'failure'
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: installer-logs
119+
path: ${env:Temp}/install*.log*
120+
113121
- name: Check Swift version
114122
if: runner.os == 'Windows'
115123
id: swift-version

0 commit comments

Comments
 (0)