Skip to content

Commit a02172e

Browse files
committed
cargo-rail: fixing the lockfile issue in releases
1 parent a92a8c6 commit a02172e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/release/publisher.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,19 @@ impl<'a> ReleasePublisher<'a> {
248248
fn commit_version_bump(&self, plan: &CrateReleasePlan) -> RailResult<()> {
249249
let message = format!("chore(release): {} v{}", plan.name, plan.new_version);
250250

251+
// Update Cargo.lock to reflect the new version
252+
// This is necessary because editing Cargo.toml doesn't automatically update the lockfile
253+
let output = Command::new("cargo")
254+
.current_dir(self.ctx.workspace_root())
255+
.args(["update", "--workspace"])
256+
.output()
257+
.map_err(|e| RailError::message(format!("Failed to run cargo update: {}", e)))?;
258+
259+
if !output.status.success() {
260+
let stderr = String::from_utf8_lossy(&output.stderr);
261+
return Err(RailError::message(format!("cargo update failed: {}", stderr)));
262+
}
263+
251264
let output = Command::new("git")
252265
.current_dir(self.ctx.workspace_root())
253266
.args(["add", "."])

0 commit comments

Comments
 (0)