Skip to content

Commit 90f124c

Browse files
authored
KCL bumper should reset hotfixes (#12251)
For example, bumping 0.1.87-beta should yield 0.1.88, no beta. This is helpful so we can do one-off releases (e.g. hotfixes to the Python bindings and then ensure the bumper will bump them back to normal)
1 parent 66bf83e commit 90f124c

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

rust/kcl-bumper/src/main.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ fn update_semver(bump: Option<SemverBump>, cargo_dot_toml: &mut DocumentMut) ->
8989
SemverBump::Minor => next_version.minor += 1,
9090
SemverBump::Patch => next_version.patch += 1,
9191
};
92+
next_version.pre = Default::default();
9293

9394
// Update the Cargo.toml
9495
cargo_dot_toml["package"]["version"] = value(next_version.to_string());
@@ -227,6 +228,32 @@ anyhow = "1.0.81"
227228
name = "bumper"
228229
version = "0.1.1"
229230
231+
[dependencies]
232+
anyhow = "1.0.81"
233+
"#
234+
);
235+
}
236+
237+
#[test]
238+
fn test_bump_patch_dash_pre() {
239+
let mut cargo_dot_toml = r#"
240+
[package]
241+
name = "bumper"
242+
version = "0.1.0-hotfix"
243+
244+
[dependencies]
245+
anyhow = "1.0.81"
246+
"#
247+
.parse::<DocumentMut>()
248+
.unwrap();
249+
update_semver(Some(SemverBump::Patch), &mut cargo_dot_toml).unwrap();
250+
assert_eq!(
251+
cargo_dot_toml.to_string(),
252+
r#"
253+
[package]
254+
name = "bumper"
255+
version = "0.1.1"
256+
230257
[dependencies]
231258
anyhow = "1.0.81"
232259
"#

0 commit comments

Comments
 (0)