organize folder #11
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
| # This workflow will build a .NET project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
| name: Build project on Windows | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths-ignore: | |
| - "**.md" | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| env: | |
| LIB_CSPROJ: src/PJ.ContextActions.Maui/PJ.ContextActions.Maui.csproj | |
| SAMPLE_CSPROJ: samples/PJ.ContextActions.Sample/PJ.ContextActions.Sample.csproj | |
| NugetPackageVersion: '99.0.0-preview${{ github.run_number }}' | |
| CurrentSemanticVersionBase: '99.0.0' | |
| Package_Creation_Path: './src/PJ.ContextActions.Maui/bin/Release' | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Get Nuget version and Name for PR | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| echo "NugetPackageVersion=${{ env.CurrentSemanticVersionBase }}-build-${{ github.event.pull_request.number }}.${{ github.run_number }}+${{ github.sha }}" | |
| shell: bash | |
| - name: Workload install | |
| run: dotnet workload install maui | |
| - name: Install Windows SDK | |
| run: dotnet workload install maui-windows | |
| - name: Restore library dependencies | |
| run: dotnet restore ${{env.LIB_CSPROJ}} | |
| - name: Restore sample dependencies | |
| run: dotnet restore ${{env.SAMPLE_CSPROJ}} | |
| # Platform-specific builds for the library | |
| - name: Build library (Windows) | |
| run: dotnet build ${{env.LIB_CSPROJ}} -c Release -f net9.0-windows10.0.19041.0 -p:PackageVersion=${{ env.NugetPackageVersion }} -p:Version=${{ env.NugetPackageVersion }} --no-restore | |
| - name: Build library (Android) | |
| run: dotnet build ${{env.LIB_CSPROJ}} -c Release -f net9.0-android -p:PackageVersion=${{ env.NugetPackageVersion }} -p:Version=${{ env.NugetPackageVersion }} --no-restore | |
| - name: Build library (iOS) | |
| run: dotnet build ${{env.LIB_CSPROJ}} -c Release -f net9.0-ios -p:PackageVersion=${{ env.NugetPackageVersion }} -p:Version=${{ env.NugetPackageVersion }} --no-restore | |
| # Platform-specific builds for the sample app | |
| - name: Build Sample app (Windows) | |
| run: dotnet build ${{env.SAMPLE_CSPROJ}} -c Release -f net9.0-windows10.0.19041.0 --no-restore | |
| - name: Build Sample app (Android) | |
| run: dotnet build ${{env.SAMPLE_CSPROJ}} -c Release -f net9.0-android --no-restore | |
| # NuGet packaging - this will package all platforms since we've built them all above | |
| - name: Create Nuget | |
| run: dotnet pack ${{env.LIB_CSPROJ}} -c Release --no-restore --no-build --include-symbols --include-source | |
| - name: Copy NuGet Packages to Staging Directory | |
| if: ${{ runner.os == 'Windows' && !startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| mkdir -p ${{ github.workspace }}/nuget | |
| Get-ChildItem -Path ${{env.Package_Creation_Path}} -Recurse | Where-Object { $_.Extension -match "nupkg" } | Copy-Item -Destination "${{ github.workspace }}/nuget" | |
| shell: pwsh | |
| - name: List NuGet packages found | |
| run: | | |
| Get-ChildItem -Path "${{ github.workspace }}/nuget" | Format-Table Name | |
| shell: pwsh | |
| - name: Publish Packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages | |
| path: ${{ github.workspace }}/nuget/ |