build(xtask): bump build.zig.zon version when bumping versions
This commit is contained in:
parent
32cfceec62
commit
c19f23f420
1 changed files with 23 additions and 0 deletions
|
|
@ -120,6 +120,7 @@ pub fn bump_versions() -> Result<(), Box<dyn std::error::Error>> {
|
|||
update_crates(¤t_version, &version)?;
|
||||
update_makefile(&version)?;
|
||||
update_npm(&version)?;
|
||||
update_zig(&version)?;
|
||||
tag_next_version(&repo, &version)?;
|
||||
|
||||
Ok(())
|
||||
|
|
@ -145,6 +146,7 @@ fn tag_next_version(
|
|||
"cli/npm/package.json",
|
||||
"lib/binding_web/package.json",
|
||||
"Makefile",
|
||||
"build.zig.zon",
|
||||
] {
|
||||
index.add_path(Path::new(file))?;
|
||||
}
|
||||
|
|
@ -244,6 +246,27 @@ fn update_npm(next_version: &Version) -> Result<(), Box<dyn std::error::Error>>
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn update_zig(next_version: &Version) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let zig = std::fs::read_to_string("build.zig.zon")?;
|
||||
|
||||
let zig = zig
|
||||
.lines()
|
||||
.map(|line| {
|
||||
if line.starts_with(" .version") {
|
||||
format!(" .version = \"{next_version}\",")
|
||||
} else {
|
||||
line.to_string()
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
+ "\n";
|
||||
|
||||
std::fs::write("build.zig.zon", zig)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// read Cargo.toml and get the version
|
||||
fn fetch_workspace_version() -> Result<String, Box<dyn std::error::Error>> {
|
||||
let cargo_toml = toml::from_str::<Value>(&std::fs::read_to_string("Cargo.toml")?)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue