Switch NuGet publish workflow to trusted publishing #320
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: .NET Continuous Integration | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Restore tools | |
| run: dotnet tool restore | |
| - name: Restore dependencies | |
| run: dotnet restore SharedCode.sln | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release SharedCode.sln | |
| - name: Run tests with coverage | |
| shell: pwsh | |
| run: > | |
| dotnet tool run dotnet-coverage collect | |
| --output coverage.xml | |
| --output-format cobertura | |
| -- | |
| pwsh -NoLogo -NoProfile -File ./.github/scripts/run-tunit-tests.ps1 | |
| - name: Generate coverage report | |
| if: always() | |
| run: > | |
| dotnet tool run reportgenerator | |
| -reports:coverage.xml | |
| -targetdir:coverage-report | |
| "-reporttypes:Html;MarkdownSummaryGithub;Cobertura" | |
| - name: Write coverage summary to workflow | |
| if: always() | |
| run: cat coverage-report/SummaryGithub.md >> $env:GITHUB_STEP_SUMMARY | |
| shell: pwsh | |
| - name: Post coverage comment on PR | |
| if: always() && github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v3 | |
| with: | |
| header: coverage | |
| path: coverage-report/SummaryGithub.md | |
| - name: Upload coverage report | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage-report | |
| path: coverage-report/ | |
| if-no-files-found: ignore |