Skip to content

Commit 8ce05ae

Browse files
committed
fix: script release failure
1 parent bba6db0 commit 8ce05ae

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

release.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,22 @@ async function release() {
474474
// Step 10: GitHub release.
475475
await createGitHubRelease(version, releaseNotes);
476476

477-
// Step 11: back to master.
478-
run("git checkout master");
477+
// Step 11: back to master. cargo's per-crate publish verification re-resolves
478+
// dependencies and can rewrite Cargo.lock with incidental transitive drift
479+
// (e.g. a patch bump of a transitive dep) *after* cargo-workspaces made the
480+
// release commit. That dirties the working tree and would abort the branch
481+
// switch. The drift isn't part of the release — the published crates and the
482+
// tag don't include it, and it re-resolves on the next build — so discard it.
483+
// Everything important is already published/pushed, so keep this cleanup
484+
// best-effort rather than failing the whole run on it.
485+
run("git checkout -- Cargo.lock", { allowFailure: true });
486+
if (run("git checkout master", { allowFailure: true }) === null) {
487+
console.warn(
488+
"⚠️ Could not switch back to master — the working tree still has local " +
489+
"changes. The release itself is complete; run `git checkout master` " +
490+
"manually after handling them."
491+
);
492+
}
479493

480494
console.log("\n🎉 Release complete!");
481495
console.log(" - All crates published to crates.io");

0 commit comments

Comments
 (0)