Fix CI: use VS 18 MSBuild + dotnet restore for WinAppSdk #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release & Publish NuGet | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: windows-2025 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| vs-version: '[18.0,)' | |
| - name: Setup NuGet | |
| uses: nuget/setup-nuget@v2 | |
| - name: Extract version from tag | |
| id: version | |
| shell: pwsh | |
| run: | | |
| $tag = "${{ github.ref_name }}" | |
| $ver = $tag -replace '^v', '' | |
| "VERSION=$ver" >> $env:GITHUB_OUTPUT | |
| - name: Restore & Build UWP library | |
| shell: pwsh | |
| run: | | |
| nuget restore src/CompositionCollectionView/CompositionCollectionView.csproj | |
| msbuild src/CompositionCollectionView/CompositionCollectionView.csproj ` | |
| /t:Build /p:Configuration=Release /p:Platform=AnyCPU | |
| - name: Restore & Build WinAppSdk library | |
| shell: pwsh | |
| run: | | |
| # Restore using dotnet (has .NET 10 SDK), build using msbuild (has VS toolset for PRI) | |
| dotnet restore src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj -p:Platform=x64 | |
| # Find VS MSBuild that supports .NET 10 | |
| $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find "MSBuild\**\Bin\MSBuild.exe" | Select-Object -First 1 | |
| Write-Host "Using MSBuild: $vsPath" | |
| & $vsPath src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj ` | |
| /t:Build /p:Configuration=Release /p:Platform=x64 | |
| - name: Pack NuGet | |
| shell: pwsh | |
| run: | | |
| nuget pack CompositionCollectionView.nuspec ` | |
| -Version ${{ steps.version.outputs.VERSION }} ` | |
| -OutputDirectory artifacts | |
| - name: Push to NuGet.org | |
| shell: pwsh | |
| run: | | |
| dotnet nuget push artifacts/*.nupkg ` | |
| --api-key ${{ secrets.NUGET_API_KEY }} ` | |
| --source https://api.nuget.org/v3/index.json ` | |
| --skip-duplicate | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: artifacts/*.nupkg |