Skip to content

[XAPI-2340] Switch NuGet publishing to Trusted Publishing (OIDC) - #663

Merged
the-chris-mitchell merged 1 commit into
masterfrom
xapi-2340-nuget-trusted-publishing
Aug 10, 2026
Merged

[XAPI-2340] Switch NuGet publishing to Trusted Publishing (OIDC)#663
the-chris-mitchell merged 1 commit into
masterfrom
xapi-2340-nuget-trusted-publishing

Conversation

@the-chris-mitchell

@the-chris-mitchell the-chris-mitchell commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Switch both publish-Oauth2-package.yml and publish-Oauth2Client-package.yml from the long-lived NUGET_APIKEY secret to NuGet Trusted Publishing (OIDC-based, short-lived keys), using NuGet/login@v1.
  • Root cause for switching now: the OAuth2Client publish has been failing since 2026-07-14 with a 403 ("API key is invalid, has expired, or does not have permission to access the specified package"), most likely because the key's package-scope glob on nuget.org never covered Xero.NetStandard.OAuth2Client. Trusted Publishing removes the recurring scoping problem and the long-lived secret entirely.

Before this can be merged/run successfully

  1. Add a repository variable NUGET_USER (Settings → Secrets and variables → Actions → Variables) set to the nuget.org profile name (not email) that owns these packages.
  2. Register two Trusted Publishing policies on nuget.org (Account → Trusted Publishing):
    • Repo: XeroAPI/Xero-NetStandard, Workflow file: publish-Oauth2-package.yml, Environment: prod
    • Repo: XeroAPI/Xero-NetStandard, Workflow file: publish-Oauth2Client-package.yml, Environment: prod
  3. Once merged, the NUGET_APIKEY secret can be removed (kept for now in case of rollback).

Test plan

  • NUGET_USER repo variable set
  • Trusted Publishing policies registered for both workflow files (environment prod)
  • Manually trigger Publish OAuth2Client Package via workflow_dispatch and confirm the NuGet login step succeeds and push completes
  • Manually trigger Publish OAuth2 Package via workflow_dispatch and confirm the same

Jira: https://xero.atlassian.net/browse/XAPI-2340

🤖 Generated with Claude Code

Replaces the long-lived NUGET_APIKEY secret with NuGet's Trusted
Publishing flow (NuGet/login@v1 + id-token: write) for both the
OAuth2 and OAuth2Client publish workflows. The OAuth2Client publish
has been failing with a 403 since 2026-07-14, likely because the
API key's package scope doesn't cover Xero.NetStandard.OAuth2Client;
Trusted Publishing removes the scoping problem and the long-lived
secret entirely.
@the-chris-mitchell
the-chris-mitchell force-pushed the xapi-2340-nuget-trusted-publishing branch from fdabf81 to b0186d1 Compare August 10, 2026 03:31
@the-chris-mitchell
the-chris-mitchell marked this pull request as ready for review August 10, 2026 03:34

@shehanster shehanster left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. lets test this out

@the-chris-mitchell
the-chris-mitchell merged commit 160597a into master Aug 10, 2026
4 checks passed
@the-chris-mitchell
the-chris-mitchell deleted the xapi-2340-nuget-trusted-publishing branch August 10, 2026 03:47
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.

2 participants