Skip to content

ci: publish to NuGet with trusted publishing - #62

Merged
kamronbatman merged 1 commit into
mainfrom
ci/nuget-trusted-publishing
Nov 6, 2026
Merged

kamronbatman merged 1 commit into
mainfrom
ci/nuget-trusted-publishing

Conversation

@kamronbatman

@kamronbatman kamronbatman commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Publishes to nuget.org with trusted publishing instead of a long-lived API key.

  • New .github/workflows/publish.yml, run manually (Actions → Publish to NuGet → Run workflow) and only from main.
  • Packs ModernUO.Serialization.Annotations, ModernUO.Serialization.Generator and ModernUOSchemaGenerator, then NuGet/login@v1 exchanges the job's GitHub OIDC token for a one-hour API key and pushes with --skip-duplicate.
  • The job runs in the nuget environment, which the nuget.org policy is scoped to; add required reviewers there to gate releases.
  • The nuget.org username comes from the NUGET_USER organization secret.
  • Removes build.yml, which pushed with the NUGET_API_KEY secret. Delete that secret and revoke the key after the first trusted publish.

Configuration (done)

  • nuget.org trusted publishing policy: owner ModernUO, repo modernuo/SerializationGenerator, workflow publish.yml, environment nuget, scoped to this repo's packages.
  • NUGET_USER organization secret.

Release steps

Bump PackageVersion in the csproj, merge, run the workflow. A version already on nuget.org is skipped without failing the run.

Test plan

  • dotnet pack of each listed project locally; package contents checked
  • First workflow run publishes (also locks the policy to this repo's ID)

Replaces long-lived API keys with nuget.org trusted publishing: the
manually dispatched publish workflow exchanges the job's GitHub OIDC
token for a short-lived key via NuGet/login. Runs only from main and
in the "nuget" environment so approvals can gate releases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kamronbatman
kamronbatman merged commit 8ed94e7 into main Nov 6, 2026
2 checks passed
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