Merge pull request #161 from Astn/api-vocabulary #18
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: Build Master | |
| on: | |
| push: | |
| paths-ignore: | |
| - "**/*.md" | |
| branches: [ master ] | |
| # Publishing uses nuget.org Trusted Publishing: the job requests an OIDC token from GitHub, NuGet/login exchanges | |
| # it for an API key that lives one hour, and the push uses that key. No long-lived NuGet secret is stored here. | |
| # The nuget.org policy is bound to this repository and to this file's name (build_publish_master.yml); renaming | |
| # the file or moving the push to another workflow needs a new policy on nuget.org. | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| # global.json pins the SDK; the 8.0 runtime is needed for the net8.0 test target. | |
| global-json-file: global.json | |
| dotnet-version: | | |
| 8.0.x | |
| 10.0.x | |
| - name: Install dependencies | |
| run: dotnet restore AustinHarris.JsonRpc.sln | |
| # Building the solution packs every package project (GeneratePackageOnBuild); `dotnet pack` on the | |
| # solution would trip NU5026 with GeneratePackageOnBuild, so the packages come from the build. | |
| # ContinuousIntegrationBuild makes the build deterministic and lets Source Link map the symbols package | |
| # (.snupkg, pushed alongside each .nupkg) back to this commit on GitHub. | |
| - name: Build | |
| run: dotnet build AustinHarris.JsonRpc.sln --configuration Release --no-restore -p:ContinuousIntegrationBuild=true | |
| - name: Test | |
| run: dotnet test AustinHarris.JsonRpcTestN --configuration Release --no-build | |
| # The key is requested after the tests so it is fresh for the push (it expires after one hour). `user` is the | |
| # nuget.org profile that owns the packages and the trusted publishing policy. | |
| - name: NuGet login (OIDC to a temporary API key) | |
| uses: NuGet/login@v1 | |
| id: nuget-login | |
| with: | |
| user: AustinHarris | |
| # Publish all four packages: the core and the three companions (Json.NET, System.Text.Json, ASP.NET Core). | |
| - name: publish nuget version change | |
| run: | | |
| for project in Json-Rpc AustinHarris.JsonRpc.Newtonsoft AustinHarris.JsonRpc.SystemTextJson AustinHarris.JsonRpc.AspNetCore; do | |
| dotnet nuget push "$project/bin/Release/"*.nupkg --skip-duplicate --source "https://api.nuget.org/v3/index.json" --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" | |
| done |