fix(cargo-workspace): don't release publish = false members pulled in as dependents - #2856
Open
nazq wants to merge 1 commit into
Open
fix(cargo-workspace): don't release publish = false members pulled in as dependents#2856nazq wants to merge 1 commit into
nazq wants to merge 1 commit into
Conversation
… as dependents A workspace member with `publish = false` that is pulled into a release only because one of its dependencies was bumped no longer gets its own release pull request, tag, or manifest entry. It is still version-bumped so its dependents stay consistent — only the standalone release is suppressed. A `publish = false` crate that is listed in the release-please config and has changes of its own is unaffected and releases as before, matching the semantics that `publish = false` means "not published to a registry", not "never released". Adds a `shouldCreateReleasePullRequest` hook to the base workspace plugin (defaulting to true, so node/maven workspaces are unchanged) which the cargo-workspace plugin overrides based on the crate's `publish` field. Fixes googleapis#1980
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.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #1980 🦕
Problem
With the
cargo-workspaceplugin, every workspace member is pulled into the dependency graph and version-bumped when a dependency is bumped — including crates markedpublish = false. Whenseparate-pull-requestsis enabled, apublish = falsecrate that only appears as a transitive dependent gets its own standalone release pull request (and tag / manifest entry), even though it is never published anywhere. This produces an empty, noisy release PR on every release.This is the request in #1980. The discussion there raised a valid concern: some teams do want their
publish = falsecrates released (version bumped, GitHub release made) —publish = falseonly means "don't push to a registry". So a blanket "skip allpublish = falsecrates" would be wrong.Solution
Suppress the standalone release only for a
publish = falsecrate that is pulled in solely as a dependent (i.e. it has no release candidate of its own):Cargo.tomlentries and the lockfile stay consistent..release-please-manifest.jsonentry.Teams that want a
publish = falsecrate released simply list it in their release-pleasepackagesconfig as usual — it then has its own release candidate, and this new behavior does not apply to it. Both camps from #1980 are satisfied with no new configuration.Implementation
shouldCreateReleasePullRequest(pkg)hook to the baseWorkspacePlugin(defaults totrue, sonode-workspaceandmaven-workspaceare unchanged).CargoWorkspaceoverrides it to returnfalsefor crates whose manifest setspublish = false.updatedPathVersions) entry — the version bump itself is unaffected.Tests / docs
test/fixtures/plugins/cargo-workspace-publish-false) and test asserting apublish = falsedependent is not turned into a release PR.cargo-workspace/node-workspace/maven-workspacesuites unchanged and passing.docs/manifest-releaser.mdcargo-workspace section documents the behavior.