Skip to content

Publish to NuGet with Trusted Publishing instead of an API key - #103

Merged
joadan merged 1 commit into
mainfrom
nuget-trusted-publishing
Oct 13, 2026
Merged

joadan merged 1 commit into
mainfrom
nuget-trusted-publishing

Conversation

@joadan

@joadan joadan commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

The last release run failed at the NuGet push with 403 - The specified API key is invalid, has expired.... The NUGET_API_KEY secret was set on 2025-10-07 and has expired, and nuget.org now caps new API keys at 30 days (announcement).

This switches release.yml to Trusted Publishing:

  • id-token: write permission so the job can request a GitHub OIDC token.
  • A NuGet/login@v1 step (user joadan) that exchanges it for a one-hour NuGet API key, authorised by the Linq2GraphQL-owned nuget.org policy for Linq2GraphQL/Linq2GraphQL.Client + release.yml.
  • dotnet nuget push uses that key instead of secrets.NUGET_API_KEY.

Once a release has published successfully, the NUGET_API_KEY repository secret is unused and can be deleted.

nuget.org now caps API keys at 30 days and the stored NUGET_API_KEY had expired, failing the release with a 403. The release job now requests a GitHub OIDC token and exchanges it through NuGet/login for a one-hour API key, which the trusted publishing policy for this repository and workflow file authorises.
@joadan
joadan merged commit 9730de4 into main Oct 13, 2026
2 checks passed
@joadan
joadan deleted the nuget-trusted-publishing branch October 13, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant