Restore OIDC trusted publishing for NuGet package publishing#704
Restore OIDC trusted publishing for NuGet package publishing#704hoangthanh28 merged 7 commits intomainfrom
Conversation
- Remove id-token: write permissions from build-netcore-tool and build-nuget-package jobs - Remove NuGet/login@v1 OIDC authentication steps - Update push commands to use secrets.NUGET_API_KEY instead of OIDC token - This restores the previous working behavior for NuGet package publishing Co-authored-by: erikbra <1628994+erikbra@users.noreply.github.com>
|
Feel free to revert this if you'd like, but Trusted Publishing seems to be the preferred option to avoid long-lived secrets. I think the configuration should now be updated for the new repo path etc. |
|
I agree, I don't want to revert it long-term, but it looks like we _might_
need a publishing certificate to make this work (or I might mix things up).
Anyways, I _have_ ordered a code signing cert, so we can start signing the
NuGet packages soon too (even if that might be unrelated)
ons. 17. des. 2025 kl. 22:36 skrev Tim Thompson ***@***.***>:
… *wokket* left a comment (grate-devs/grate#704)
<#704 (comment)>
Feel free to revert this if you'd like, but Trusted Publishing seems to be
the preferred option to avoid long-lived secrets. I *think* the
configuration should now be updated for the new repo path etc.
—
Reply to this email directly, view it on GitHub
<#704 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMNWQUZ6ZXDTA3EMS6HHAT4CHEHTAVCNFSM6AAAAACPLKIKG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNRXGMYDOOBVG4>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
|
The Publish build still seems to fail in the main branch, @wokket . Have you done anything now today (night, whichever part of the day it is in your hemisphere :D) to fix things? The latest build of main failed due to some OIDC nuget auth failure. Is this double slash in the URL correct? Or did someone add an extra slash (trailing or in the middle) here?
|
|
I added you to this repo, @hoangthanh28 . Did it work? I didn't have time to look more at this one today, sorry |
|
Hi @erikbra Run dotnet nuget push /tmp/grate/nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --api-key "***" --skip-duplicate
dotnet nuget push /tmp/grate/nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --api-key "***" --skip-duplicate
shell: /usr/bin/bash -e {0}
env:
DOTNET_ROOT: /usr/share/dotnet
Pushing grate.sqlite.2.0.6-tags-2-0-6-beta-0001.nupkg to 'https://www.nuget.org/api/v2/package'...
PUT https://www.nuget.org/api/v2/package/
Forbidden https://www.nuget.org/api/v2/package/ 211ms
error: Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have permission to access the specified package.). |
|
@copilot rebase |
- Re-enable id-token: write permissions for build-netcore-tool and build-nuget-package jobs - Restore NuGet/login@v1 OIDC authentication steps - Update push commands to use OIDC token from steps.login.outputs.NUGET_API_KEY - This restores trusted publishing now that it has been properly configured on NuGet.org Co-authored-by: hoangthanh28 <15929198+hoangthanh28@users.noreply.github.com>
- Add proper spacing in template expressions: ${{ steps.login.outputs.NUGET_API_KEY }}
- Ensures consistency with other template expressions in the workflow file
Co-authored-by: hoangthanh28 <15929198+hoangthanh28@users.noreply.github.com>
- Fix spelling: 'hard coded' to 'hardcoded' for consistency - Remove trailing whitespace for cleaner formatting Co-authored-by: hoangthanh28 <15929198+hoangthanh28@users.noreply.github.com>
- Clean up trailing whitespace throughout the workflow file for consistent formatting Co-authored-by: hoangthanh28 <15929198+hoangthanh28@users.noreply.github.com>
.github/workflows/build.yml
Outdated
| - name: NuGet login (OIDC → temp API key) | ||
| uses: NuGet/login@v1 | ||
| if: ${{ needs.set-version-number.outputs.is-release == 'true' }} | ||
| id: login |
There was a problem hiding this comment.
please remove it, we don't need this step. Will use the token when pushing to Nuget
|
Waiting for the final build to check. |


After @wokket properly reconfigured trusted publishing on NuGet.org following ownership changes, this PR restores OIDC-based authentication for NuGet package publishing.
Changes:
id-token: writepermissions tobuild-netcore-toolandbuild-nuget-packagejobsNuGet/login@v1OIDC authentication stepsdotnet nuget pushcommands to use OIDC-generated API key fromsteps.login.outputs.NUGET_API_KEYBefore (API Key):
After (OIDC):
OIDC trusted publishing is the preferred approach as it uses short-lived tokens instead of long-lived API key secrets.
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.