File tree 1 file changed +14
-2
lines changed 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,24 @@ jobs:
52
52
if : matrix.os == 'ubuntu-latest'
53
53
run : |
54
54
dotnet tool install --global PowerShell
55
+ - name : Find latest PowerShell version (Windows)
56
+ if : matrix.os == 'windows-latest'
57
+ shell : pwsh
58
+ run : |
59
+ $packageName = "powershell"
60
+ $output = dotnet tool search $packageName --take 1
61
+ $outputAsSingleLine = ("" + $output)
62
+ $indexOfVersionLine = $outputAsSingleLine.IndexOf($packageName)
63
+ $latestVersion = $outputAsSingleLine.substring($indexOfVersionLine + $packageName.length).trim().split(" ")[0].trim()
64
+
65
+ Write-Output "Found PowerShell version: $latestVersion"
66
+ Write-Output "POWERSHELL_LATEST_VERSION=$latestVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
55
67
- name : Setup PowerShell (Windows)
56
68
if : matrix.os == 'windows-latest'
57
69
shell : cmd
58
70
run : |
59
- curl --location --output "%RUNNER_TEMP%\PowerShell-7.3.6 -win-x64.msi" https://github.com/PowerShell/PowerShell/releases/download/v7.3.6 /PowerShell-7.3.6 -win-x64.msi
60
- msiexec.exe /package "%RUNNER_TEMP%\PowerShell-7.3.6 -win-x64.msi" /quiet USE_MU=1 ENABLE_MU=1 ADD_PATH=1 DISABLE_TELEMETRY=1
71
+ curl --location --output "%RUNNER_TEMP%\PowerShell-%POWERSHELL_LATEST_VERSION% -win-x64.msi" https://github.com/PowerShell/PowerShell/releases/download/latest /PowerShell-%POWERSHELL_LATEST_VERSION% -win-x64.msi
72
+ msiexec.exe /package "%RUNNER_TEMP%\PowerShell-%POWERSHELL_LATEST_VERSION% -win-x64.msi" /quiet USE_MU=1 ENABLE_MU=1 ADD_PATH=1 DISABLE_TELEMETRY=1
61
73
- name : Setup PowerShell (macOS)
62
74
if : matrix.os == 'macos-latest'
63
75
run : |
You can’t perform that action at this time.
0 commit comments