Skip to content

ci: gate NuGet push behind builds and release#7

Merged
PascalSenn merged 1 commit into
mainfrom
fix/gate-nuget-push
Jun 8, 2026
Merged

ci: gate NuGet push behind builds and release#7
PascalSenn merged 1 commit into
mainfrom
fix/gate-nuget-push

Conversation

@PascalSenn

Copy link
Copy Markdown
Member

Problem

The `nuget` job only declared `needs: version`, so it packed and pushed to NuGet.org in parallel with the platform builds:

```
version
├─ build (matrix: 6 RIDs incl. win-x64, win-arm64)
├─ release needs: [version, build] ← gated on all builds
└─ nuget needs: version ← NOT gated
```

If a Windows build failed, `release` was correctly skipped — but `nuget` had already run `dotnet nuget push`. The result is a tool live on NuGet.org with no corresponding GitHub release or binaries. And it's permanent: a NuGet version can only be delisted, never re-pushed under the same number.

Fix

```yaml
nuget:
needs: [version, build, release] # was: version
```

The package now publishes only after all six platforms build and the GitHub release is published. The GitHub release (with attested binaries) stays the source of truth; the NuGet package can never point at a version that has no release.

Trade-off

Because `release` carries `if: startsWith(github.ref, 'refs/tags/v')`, the `nuget` job is now also skipped on `workflow_dispatch` runs — so dispatch no longer produces a test `.nupkg` artifact. The push step was already tag-guarded and never ran on dispatch, so only test-packing is lost. Acceptable for the consistency gain.

The nuget job only needed the version job, so it packed and pushed to
NuGet.org in parallel with the platform builds. A failing Windows build
would skip the GitHub release but leave the tool already published — a
permanent state, since a NuGet version can only be delisted, never
re-pushed.

Gate the nuget job on [version, build, release] so the package goes out
only after all six platforms build and the GitHub release is published.
The GitHub release with attested binaries stays the source of truth; the
NuGet package never points at a version with no release.
Copilot AI review requested due to automatic review settings June 8, 2026 21:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the release workflow so NuGet publishing is properly gated behind successful platform builds and the GitHub release job, preventing packages from being pushed when a release is skipped due to build failures.

Changes:

  • Update the nuget job dependency graph to wait for build and release (not just version) before running.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 158 to 162
nuget:
name: 📦 Pack NuGet Tool
needs: version
needs: [version, build, release]
runs-on: ubuntu-latest
steps:

@PascalSenn PascalSenn left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

LGTM

@PascalSenn PascalSenn merged commit 717f72c into main Jun 8, 2026
5 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.

2 participants