Skip to content

Unify NuGet publishing into one workflow with trusted publishing - #375

Merged
follesoe merged 1 commit into
mainfrom
ci/nuget-trusted-publishing
Jun 22, 2026
Merged

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

Conversation

@follesoe

Copy link
Copy Markdown
Contributor

Summary

Replaces the two separate publish workflows (CI-Maui.yml → GitHub Packages, CI-Windows.yml → nuget.org) with a single publish.yml that builds once and pushes all five packages at one consistent version.

What changed

  • One build, one version: every run packs all packages at 2.0.0.<run_number> (VersionMain from Directory.Build.props + the GitHub run number).
  • nuget.org via Trusted Publishing (OIDC): uses NuGet/login@v1 to mint a short-lived API key (id-token: write) instead of the long-lived NUGET_API_TOKEN secret.
  • GitHub Packages unchanged: still authenticated with the built-in GITHUB_TOKEN (packages: write); pushed on every manual run.
  • Deliberate releases: the workflow is workflow_dispatch only (never on commit/merge). The nuget.org push is gated behind a publish_to_nuget boolean input — leave it unticked for a GitHub Packages-only build, tick it to also release to nuget.org.

Required nuget.org configuration

A Trusted Publishing policy must exist on nuget.org with:

  • Package Owner: follesoe
  • Repository Owner: microcharts-dotnet
  • Repository: Microcharts
  • Workflow File: publish.yml

Once this merges, run the workflow once with publish_to_nuget enabled within 7 days to lock the policy to permanently active. After a successful nuget.org publish, the old NUGET_API_TOKEN secret can be deleted.

🤖 Generated with Claude Code

Replace CI-Maui.yml (GitHub Packages) and CI-Windows.yml (nuget.org) with a
single publish.yml that builds once and pushes all five packages at one
version (2.0.0.<run_number>).

- nuget.org now uses OIDC trusted publishing via NuGet/login@v1 instead of a
  long-lived NUGET_API_TOKEN secret.
- GitHub Packages publish is unchanged (GITHUB_TOKEN), and runs on every
  manual dispatch.
- nuget.org publish is gated behind an explicit workflow_dispatch input
  (publish_to_nuget) so releases are deliberate, never on commit/merge.

Trusted publishing policy on nuget.org must reference workflow file publish.yml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@follesoe
follesoe force-pushed the ci/nuget-trusted-publishing branch from a32adee to 9b47818 Compare June 22, 2026 21:06
@follesoe follesoe self-assigned this Jun 22, 2026
@follesoe
follesoe merged commit 7bb91db into main Jun 22, 2026
2 checks passed
@follesoe
follesoe deleted the ci/nuget-trusted-publishing branch June 22, 2026 21:23
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