Skip to content

Commit 427061d

Browse files
committed
Auto merge of rust-lang#12581 - lnicola:changelog-number, r=lnicola
internal: Handle fractional release numbers in changelog naming
2 parents eb9b360 + e48ed53 commit 427061d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

xtask/src/release.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ impl flags::Release {
3636

3737
let today = date_iso(sh)?;
3838
let commit = cmd!(sh, "git rev-parse HEAD").read()?;
39-
let changelog_n = sh.read_dir(changelog_dir.as_path())?.len();
39+
let changelog_n = sh
40+
.read_dir(changelog_dir.as_path())?
41+
.into_iter()
42+
.filter_map(|p| p.file_stem().map(|s| s.to_string_lossy().to_string()))
43+
.filter_map(|s| s.splitn(5, '-').last().map(|n| n.replace('-', ".")))
44+
.filter_map(|s| s.parse::<f32>().ok())
45+
.map(|n| 1 + n.floor() as usize)
46+
.max()
47+
.unwrap_or_default();
4048

4149
for adoc in [
4250
"manual.adoc",

0 commit comments

Comments
 (0)