Migrate NuGet publish to trusted publishing (OIDC) - #92
Merged
Merged
Conversation
Replace long-lived NUGET_ORG_API_KEY secret with OIDC-based NuGet/login@v1 for keyless publishing. Adds: - environment: release (for secret scoping + approval gates) - permissions: id-token: write (required for OIDC) - NuGet/login@v1 step for token exchange - --skip-duplicate flag for idempotent pushes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced May 4, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The publish workflow currently uses a long-lived
NUGET_ORG_API_KEYsecret to push packages to nuget.org. NuGet now supports trusted publishing via OIDC, which eliminates the need to manage and rotate API keys — the workflow exchanges a short-lived GitHub Actions OIDC token for a NuGet push token at publish time.What changed
The
publishjob inbuild-publish.ymlis updated to use OIDC-based auth:environment: release— scopes secrets and enables optional approval gatespermissions: id-token: write— required for the OIDC token requestNuGet/login@v1— exchanges the OIDC token for a NuGet API key--skip-duplicate— makes pushes idempotent for safe re-runsThe build job and package matrix are unchanged.
Manual setup required
Before merging, these one-time steps are needed:
releasein Settings → Environments with a secretNUGET_USERset to the nuget.org profile usernameAndroidSdk.Tool,AndroidSdk,AndroidSdk.Adbd,AndroidRepository) with workflow =build-publish.yml, environment =releaseNUGET_ORG_API_KEYrepo secret