Fix NuGet Trusted Publishing: use 'user' input and step output for AP… #4
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags: | |
| - '[0-9]*.[0-9]*.[0-9]*' | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Build | |
| run: dotnet build Meraki.Api/Meraki.Api.csproj --configuration Release | |
| - name: Pack | |
| run: dotnet pack Meraki.Api/Meraki.Api.csproj --configuration Release --no-build -o out | |
| - name: Upload packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: | | |
| out/*.nupkg | |
| out/*.snupkg | |
| - name: NuGet Login (Trusted Publishing) | |
| id: nuget-login | |
| uses: nuget/login@v1 | |
| with: | |
| user: PanoramicData | |
| - name: Push to NuGet | |
| run: dotnet nuget push "out/*.nupkg" -k "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" -s "https://api.nuget.org/v3/index.json" |