From e48ed5316fc8533bad5a5e50b2367fa0ab94f124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sat, 18 Jun 2022 17:00:28 +0300 Subject: [PATCH] internal: Handle fractional release numbers in changelog naming --- xtask/src/release.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xtask/src/release.rs b/xtask/src/release.rs index 04544d6f6b..1c5fc64c24 100644 --- a/xtask/src/release.rs +++ b/xtask/src/release.rs @@ -36,7 +36,15 @@ impl flags::Release { let today = date_iso(sh)?; let commit = cmd!(sh, "git rev-parse HEAD").read()?; - let changelog_n = sh.read_dir(changelog_dir.as_path())?.len(); + let changelog_n = sh + .read_dir(changelog_dir.as_path())? + .into_iter() + .filter_map(|p| p.file_stem().map(|s| s.to_string_lossy().to_string())) + .filter_map(|s| s.splitn(5, '-').last().map(|n| n.replace('-', "."))) + .filter_map(|s| s.parse::().ok()) + .map(|n| 1 + n.floor() as usize) + .max() + .unwrap_or_default(); for adoc in [ "manual.adoc",