fix(ci): resolve msbuild/nuget/mage/signtool dynamically
The first v0.1.0 run failed because actions/checkout could not find Node and msbuild/nuget were never on the LocalSystem PATH after winget install. This commit pulls in the standard tool-setup actions and resolves the .NET-Framework-bound tooling (mage.exe, signtool.exe) by walking the Windows SDK / .NET 4.8 Developer Pack directories instead of hardcoding versioned paths that drift across machines. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,12 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Setup NuGet
|
||||
uses: nuget/setup-nuget@v2
|
||||
|
||||
- name: Restore NuGet
|
||||
run: nuget restore OutlookAddin.sln
|
||||
|
||||
@@ -39,13 +45,37 @@ jobs:
|
||||
needs: build
|
||||
runs-on: windows-latest
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
MAGE: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\mage.exe'
|
||||
SIGNTOOL: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool.exe'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Setup NuGet
|
||||
uses: nuget/setup-nuget@v2
|
||||
|
||||
- name: Resolve mage.exe + signtool.exe paths
|
||||
id: tools
|
||||
shell: pwsh
|
||||
run: |
|
||||
# mage.exe lives under .NET 4.8 Developer Pack. Find any installed copy.
|
||||
$mage = Get-ChildItem 'C:\Program Files (x86)\Microsoft SDKs\Windows' -Recurse -Filter mage.exe -ErrorAction SilentlyContinue |
|
||||
Sort-Object FullName -Descending | Select-Object -First 1
|
||||
if (-not $mage) { throw "mage.exe not found" }
|
||||
|
||||
# signtool.exe lives under Windows SDK. Pick the highest-version x64 copy.
|
||||
$signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin' -Recurse -Filter signtool.exe -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.FullName -like '*\x64\*' } |
|
||||
Sort-Object { [version](Split-Path -Leaf (Split-Path -Parent (Split-Path -Parent $_.FullName))) } -Descending |
|
||||
Select-Object -First 1
|
||||
if (-not $signtool) { throw "signtool.exe not found" }
|
||||
|
||||
Write-Host "MAGE: $($mage.FullName)"
|
||||
Write-Host "SIGNTOOL: $($signtool.FullName)"
|
||||
"MAGE=$($mage.FullName)" | Out-File -Append $env:GITHUB_ENV
|
||||
"SIGNTOOL=$($signtool.FullName)" | Out-File -Append $env:GITHUB_ENV
|
||||
|
||||
- name: Compute version from tag
|
||||
id: ver
|
||||
shell: pwsh
|
||||
|
||||
Reference in New Issue
Block a user