fix: update Cargo.toml version handling to use the provided version directly
This commit is contained in:
@@ -137,20 +137,19 @@ async function updateCargoVersion(newVersion) {
|
|||||||
const versionWithoutV = newVersion.startsWith("v")
|
const versionWithoutV = newVersion.startsWith("v")
|
||||||
? newVersion.slice(1)
|
? newVersion.slice(1)
|
||||||
: newVersion;
|
: newVersion;
|
||||||
const baseVersion = getBaseVersion(versionWithoutV);
|
|
||||||
|
|
||||||
const updatedLines = lines.map((line) => {
|
const updatedLines = lines.map((line) => {
|
||||||
if (line.trim().startsWith("version =")) {
|
if (line.trim().startsWith("version =")) {
|
||||||
return line.replace(
|
return line.replace(
|
||||||
/version\s*=\s*"[^"]+"/,
|
/version\s*=\s*"[^"]+"/,
|
||||||
`version = "${baseVersion}"`,
|
`version = "${versionWithoutV}"`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
});
|
});
|
||||||
|
|
||||||
await fs.writeFile(cargoTomlPath, updatedLines.join("\n"), "utf8");
|
await fs.writeFile(cargoTomlPath, updatedLines.join("\n"), "utf8");
|
||||||
console.log(`[INFO]: Cargo.toml version updated to: ${baseVersion}`);
|
console.log(`[INFO]: Cargo.toml version updated to: ${versionWithoutV}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error updating Cargo.toml version:", error);
|
console.error("Error updating Cargo.toml version:", error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in New Issue
Block a user