Create build.yml #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: Build WPF Samples | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| # .NET Framework applications must be built on a Windows runner. | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| msbuild-architecture: x64 | |
| - name: Setup NuGet | |
| uses: NuGet/setup-nuget@v2 | |
| - name: Restore NuGet packages | |
| run: nuget restore Examples/Infragistics.Samples.WPF.sln | |
| - name: Build the solution | |
| run: msbuild Examples/Infragistics.Samples.WPF.sln /p:Configuration=Release /p:Platform="Any CPU" | |
| - name: Get build output path | |
| id: get_output_path | |
| run: | | |
| $solutionFile = Get-Item -Path "Examples/Infragistics.Samples.WPF.sln" | |
| $baseDir = $solutionFile.DirectoryName | |
| Write-Host "--- Start Path Determination Log ---" | |
| Write-Host "1. Starting path analysis." | |
| Write-Host "2. Base directory for search: $baseDir" | |
| $csprojFile = Get-ChildItem -Path $baseDir -Recurse -Filter "Infragistics.SamplesBrowser.WPF.Source.csproj" | Select-Object -First 1 | |
| Write-Host "3. csprojfile: $csprojFile.FullName" | |
| $projectFile = [xml](Get-Content $csprojFile.FullName) | |
| Write-Host "5. Searching .csproj for 'Release|AnyCPU' OutputPath..." | |
| $outputPath = $projectFile.Project.PropertyGroup | Where-Object { $_.Condition -like "*'Release|AnyCPU'*" } | Select-Object -ExpandProperty OutputPath | |
| if ([string]::IsNullOrEmpty($outputPath)) { | |
| Write-Host " -> No matching OutputPath found for 'Release|Any CPU'. Trying fallback..." | |
| # Fallback to the first non-conditional PropertyGroup | |
| $outputPath = $projectFile.Project.PropertyGroup | Where-Object { -not $_.Condition } | Select-Object -ExpandProperty OutputPath | |
| } | |
| if ([string]::IsNullOrEmpty($outputPath)) { | |
| Write-Warning " -> No OutputPath found in any PropertyGroup. Output path will be empty." | |
| exit 1 | |
| } | |
| Write-Host "6. Determined relative output path: $outputPath" | |
| $fullOutputPath = Join-Path -Path $baseDir -ChildPath $outputPath | |
| Write-Host "7. Final calculated full output path: $fullOutputPath" | |
| Write-Host "8. Checking if path exists: $(Test-Path -Path $fullOutputPath)" | |
| if (-not (Test-Path -Path $fullOutputPath)) { | |
| Write-Warning " -> The final output path does not exist. This could be a problem." | |
| } | |
| echo "full_output_path=$fullOutputPath" >> $env:GITHUB_ENV | |
| Write-Host "9. output_path variable set for subsequent steps." | |
| Write-Host "--- End Path Determination Log ---" | |
| - name: Zip the build output | |
| run: | | |
| $outputPath = $env:full_output_path | |
| Write-Host "Attempting to zip from path: $outputPath" | |
| if ([string]::IsNullOrEmpty($outputPath) -or (-not (Test-Path -Path $outputPath))) { | |
| Write-Warning "Source path is empty or does not exist. Skipping zip." | |
| exit 1 | |
| } | |
| Compress-Archive -Path "$outputPath\*" -DestinationPath "wpf-app-release.zip" -Force | |
| Write-Host "Zipping complete." | |
| - name: Upload the zipped artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wpf-app-release | |
| path: wpf-app-release.zip |