Significant cleanup and reorganization #75
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 | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'src/CommonHelpers/**/*' | |
| - 'src/CommonHelpers.Tests/**/*' | |
| - '.github/workflows/ci_main.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 CommonHelpers Bin to NuGet Package Sources | |
| run: dotnet nuget add source "${{github.workspace}}\src\CommonHelpers\bin" --name "CommonHelpers_Bin" | |
| - name: Get Version From Project | |
| uses: kzrnm/get-net-sdk-project-versions-action@v2 | |
| id: get-version | |
| with: | |
| proj-path: src/CommonHelpers/CommonHelpers.csproj | |
| - name: Verify version | |
| run: echo version "${{steps.get-version.outputs.package-version}}" | |
| - 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 | |
| echo "nuget-package-path=$match" >> $env:GITHUB_OUTPUT | |
| - name: Verify Package Path | |
| run: Write-Output Package path is "${{steps.get-package-path.outputs.nuget-package-path}}" | |
| # ****** 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 NuGet package | |
| run: dotnet nuget sign ${{steps.get-package-path.outputs.nuget-package-path}} --certificate-path ${{steps.download-cert.outputs.certificate-path}} --certificate-password "${{secrets.LANCELOTSOFTWARECERT_PASSWORD}}" --timestamper "http://timestamp.digicert.com" | |
| # ***** Upload Artifacts ***** # | |
| - name: Upload CommonHelpers NuGet package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "CommonHelpers.${{steps.get-version.outputs.package-version}}.nupkg" | |
| path: ${{steps.get-package-path.outputs.nuget-package-path}} |