Update to use trusted publishing #583
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: BuildAndPack | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - '*' | |
| jobs: | |
| build-and-test: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows | |
| vm: windows-latest | |
| - os: linux | |
| vm: ubuntu-latest | |
| - os: macos | |
| vm: macos-15 | |
| env: | |
| MSBuildEnableWorkloadResolver: false | |
| DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true" | |
| name: ${{ matrix.os}} | |
| runs-on: ${{ matrix.vm}} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 10.0.x | |
| 9.0.x | |
| 8.0.x | |
| 7.0.x | |
| 6.0.x | |
| 3.1.x | |
| 2.1.x | |
| # - run: dotnet new globaljson --sdk-version "8.0.402" --force | |
| - name: Cache .nuke/temp, ~/.nuget/packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| .nuke/temp | |
| ~/.nuget/packages | |
| !~/.nuget/packages/netescapades.enumgenerators | |
| !~/.nuget/packages/netescapades.enumgenerators.interceptors | |
| key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} | |
| # Use the ambient GitHub token to login to NuGet and retrieve an API key | |
| - name: NuGet login (OIDC → temp API key) | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER || 'NOT_SET' }} | |
| - name: Run './build.cmd Clean Test TestPackage PushToNuGet | |
| run: ./build.cmd Clean Test TestPackage PushToNuGet | |
| env: | |
| NuGetToken: ${{ steps.login.outputs.NUGET_API_KEY || 'NOT_SET'}} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages-${{ matrix.os}} | |
| path: artifacts/packages | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: results-${{ matrix.os}} | |
| path: artifacts/results | |
| publish-test-results: | |
| name: "Publish Tests Results" | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| pull-requests: write # needed unless run with comment_mode: off | |
| # contents: read # only needed for private repository | |
| # issues: read # only needed for private repository | |
| if: always() | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/results | |
| - name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: "artifacts/**/*.trx" | |
| json_thousands_separator: "," | |
| check_run_annotations_branch: "*" |