feat(xtask): update nix
This commit is contained in:
parent
0719bd6ffb
commit
e9e4316569
1 changed files with 22 additions and 0 deletions
|
|
@ -166,6 +166,7 @@ pub fn run(args: BumpVersion) -> Result<()> {
|
|||
update_crates(¤t_version, &next_version)?;
|
||||
update_makefile(&next_version)?;
|
||||
update_cmake(&next_version)?;
|
||||
update_nix(&next_version)?;
|
||||
update_npm(&next_version)?;
|
||||
update_zig(&next_version)?;
|
||||
tag_next_version(&next_version)?;
|
||||
|
|
@ -181,6 +182,7 @@ fn tag_next_version(next_version: &Version) -> Result<()> {
|
|||
"Cargo.toml",
|
||||
"Makefile",
|
||||
"build.zig.zon",
|
||||
"flake.nix",
|
||||
"crates/cli/Cargo.toml",
|
||||
"crates/cli/npm/package.json",
|
||||
"crates/cli/npm/package-lock.json",
|
||||
|
|
@ -264,6 +266,26 @@ fn update_cmake(next_version: &Version) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn update_nix(next_version: &Version) -> Result<()> {
|
||||
let nix = std::fs::read_to_string("flake.nix")?;
|
||||
let nix = nix
|
||||
.lines()
|
||||
.map(|line| {
|
||||
if line.trim_start().starts_with("version =") {
|
||||
format!(" version = \"{next_version}\";")
|
||||
} else {
|
||||
line.to_string()
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
+ "\n";
|
||||
|
||||
std::fs::write("flake.nix", nix)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update_crates(current_version: &Version, next_version: &Version) -> Result<()> {
|
||||
let mut cmd = std::process::Command::new("cargo");
|
||||
cmd.arg("workspaces").arg("version");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue