Update README.md #12
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: Main [.NET MAUI] | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'src/CommonHelpers.Maui/**/*' | |
| - '.github/workflows/ci_main-maui.yml' | |
| env: | |
| DOTNET_SDK_VERSION: '9.0.x' | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install .NET Core | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{env.DOTNET_SDK_VERSION}} | |
| - name: Setup MSBuild.exe | |
| uses: microsoft/setup-msbuild@v2 | |
| # ****** CommonHelpers Tasks ***** # | |
| - name: Add Alpha (-alpha) suffix to Version Number | |
| run : | | |
| [xml]$projXml = get-content "src\CommonHelpers\CommonHelpers.csproj" | |
| Write-Output "Before: " $projXml.Project.PropertyGroup.Version | |
| $currentVer = $projXml.Project.PropertyGroup.Version | |
| $suffix = "-alpha" | |
| $newVer = $currentVer + $suffix | |
| $projXml.Project.PropertyGroup.Version = $newVer | |
| Write-Output "After: " $projXml.Project.PropertyGroup.Version | |
| $projXml.save("src\CommonHelpers\CommonHelpers.csproj") | |
| - name: Restore & Build CommonHelpers | |
| working-directory: src/CommonHelpers | |
| run: | | |
| dotnet restore --runtime any --ignore-failed-sources | |
| dotnet build --configuration Release | |
| - name: Add Bin to NuGet Package Sources | |
| run: dotnet nuget add source "${{github.workspace}}\src\CommonHelpers\bin" --name "CommonHelpers_Bin" | |
| - name: Get Package Version From Project | |
| uses: kzrnm/get-net-sdk-project-versions-action@v2 | |
| id: get-version | |
| with: | |
| proj-path: src/CommonHelpers/CommonHelpers.csproj | |
| - name: Get Package File Path | |
| id: get-package-path | |
| run : | | |
| $currentDirectory = Get-Location | |
| $outputFolder = Join-Path -Path $currentDirectory -ChildPath "src/CommonHelpers/bin/Release/" | |
| $match = Get-ChildItem $outputFolder -Recurse -Force -Include *.nupkg | |
| Write-Output "Setting output variable 'nuget-package-path' to $match" | |
| echo "nuget-package-path=$match" >> $env:GITHUB_OUTPUT | |
| # ****** CommonHelpers.Maui Tasks ***** # | |
| - name: Add Alpha (-alpha) suffix to Maui Package Version Number | |
| run : | | |
| [xml]$projXml = get-content "src\CommonHelpers.Maui\CommonHelpers.Maui.csproj" | |
| Write-Output "Before: " $projXml.Project.PropertyGroup.Version | |
| $currentVer = $projXml.Project.PropertyGroup.Version | |
| $suffix = "-alpha" | |
| $newVer = $currentVer + $suffix | |
| $projXml.Project.PropertyGroup.Version = $newVer | |
| Write-Output "After: " $projXml.Project.PropertyGroup.Version | |
| $projXml.save("src\CommonHelpers.Maui\CommonHelpers.Maui.csproj") | |
| - name: Install MAUI workloads (required for GitHub-hosted runners) | |
| run: dotnet workload install maui --source https://api.nuget.org/v3/index.json | |
| - name: Restore & Build CommonHelpers.Maui | |
| working-directory: src/CommonHelpers.Maui | |
| run: | | |
| dotnet install "CommonHelpers" --version "${{steps.get-version.outputs.package-version}}" | |
| dotnet restore --runtime any --ignore-failed-sources | |
| dotnet build --configuration Release | |
| - name: Add Bin to NuGet Package Sources | |
| run: dotnet nuget add source "${{github.workspace}}\src\CommonHelpers.Maui\bin" --name "CommonHelpers.Maui_Release" | |
| - name: Get Maui Package Version From Project | |
| uses: kzrnm/get-net-sdk-project-versions-action@v2 | |
| id: get-version-maui | |
| with: | |
| proj-path: src/CommonHelpers.Maui/CommonHelpers.Maui.csproj | |
| - name: Get Maui Package File Path | |
| id: get-package-path-maui | |
| run : | | |
| $currentDirectory = Get-Location | |
| $outputFolder = Join-Path -Path $currentDirectory -ChildPath "src/CommonHelpers.Maui/bin/Release/" | |
| $match = Get-ChildItem $outputFolder -Recurse -Force -Include *.nupkg | |
| Write-Output "Setting output variable 'nuget-package-path-maui' to $match" | |
| echo "nuget-package-path-maui=$match" >> $env:GITHUB_OUTPUT | |
| # ****** CommonHelpers.Tests Tasks ***** # | |
| - name: Restore & Build CommonHelpers.Tests | |
| working-directory: src/CommonHelpers.Tests | |
| run: | | |
| dotnet restore --runtime any --ignore-failed-sources | |
| dotnet build --configuration Release | |
| - name: Run Tests | |
| working-directory: src/CommonHelpers.Tests | |
| run: dotnet test --runtime any -c Release --logger GitHubActions --blame-crash --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
| # ***** Package Signing ***** # | |
| - name: Decode Base64 and save PFX file | |
| id: download-cert | |
| run: | | |
| $pfx_cert_byte = [System.Convert]::FromBase64String("${{secrets.LANCELOTSOFTWARECERT_BASE64}}") | |
| $currentDirectory = Get-Location | |
| $certificatePath = Join-Path -Path $currentDirectory -ChildPath "LancelotSoftware.pfx" | |
| [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | |
| echo "certificate-path=$certificatePath" >> $env:GITHUB_OUTPUT | |
| - name: Sign CommonHelpers.Maui NuGet package | |
| run: dotnet nuget sign ${{steps.get-package-path-maui.outputs.nuget-package-path-maui}} --certificate-path ${{steps.download-cert.outputs.certificate-path}} --certificate-password "${{secrets.LANCELOTSOFTWARECERT_PASSWORD}}" --timestamper "http://timestamp.digicert.com" | |
| # ***** Upload Artifacts ***** # | |
| - name: Upload CommonHelpers.Maui NuGet package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "CommonHelpers.Maui.${{steps.get-version-maui.outputs.package-version}}.nupkg" | |
| path: ${{steps.get-package-path-maui.outputs.nuget-package-path-maui}} |