|
| 1 | +name: "Build NuGet Packages" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + workflow_call: |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: "Build NuGet Package (${{ matrix.package }})" |
| 10 | + runs-on: windows-2022 |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - package: v142 |
| 15 | + toolset: v142 |
| 16 | + |
| 17 | + - package: v143 |
| 18 | + toolset: v143 |
| 19 | + |
| 20 | + - package: ZeroC.Mcpp |
| 21 | + toolset: v143 |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Check out repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Setup MSBuild |
| 28 | + uses: microsoft/setup-msbuild@v2 |
| 29 | + |
| 30 | + - name: Install MSVC v142 toolset |
| 31 | + if: matrix.toolset == 'v142' |
| 32 | + shell: pwsh |
| 33 | + run: | |
| 34 | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" |
| 35 | + $vsInstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe" |
| 36 | +
|
| 37 | + $installPath = & $vswhere -latest -products * -property installationPath |
| 38 | + if (-not $installPath) { throw "Visual Studio installation not found." } |
| 39 | +
|
| 40 | + # v142 toolset component group ID (VS2019 toolset) |
| 41 | + & $vsInstaller modify --installPath "$installPath" ` |
| 42 | + --add Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 ` |
| 43 | + --quiet --wait --norestart |
| 44 | +
|
| 45 | + - name: Build NuGet Package |
| 46 | + working-directory: msbuild |
| 47 | + run: MSBuild mcpp.proj /t:NugetPack /p:DefaultPlatformToolset=${{ matrix.toolset }} |
| 48 | + |
| 49 | + - name: Rename package directory for ZeroC.Mcpp |
| 50 | + if: matrix.package == 'ZeroC.Mcpp' |
| 51 | + working-directory: msbuild |
| 52 | + run: | |
| 53 | + Remove-Item -Path "ZeroC.Mcpp" -Recurse -Force -ErrorAction SilentlyContinue |
| 54 | + Rename-Item -Path "mcpp.v143" -NewName "ZeroC.Mcpp" |
| 55 | + Copy-Item -Path "README.ZeroC.Mcpp.md" -Destination "ZeroC.Mcpp\README.md" -Force |
| 56 | + Copy-Item -Path "ZeroC.Mcpp.nuspec" -Destination "ZeroC.Mcpp\" -Force |
| 57 | + Copy-Item -Path "ZeroC.Mcpp.targets" -Destination "ZeroC.Mcpp\build\native\" -Force |
| 58 | + nuget pack ZeroC.Mcpp\ZeroC.Mcpp.nuspec -NoPackageAnalysis -NonInteractive -OutputDirectory ZeroC.Mcpp |
| 59 | +
|
| 60 | + - name: Upload Artifacts |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: nuget-package-${{ matrix.package }} |
| 64 | + path: | |
| 65 | + msbuild/${{ matrix.package == 'ZeroC.Mcpp' && 'ZeroC.Mcpp' || format('mcpp.{0}', matrix.toolset) }}/*.nupkg |
0 commit comments