mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
35 lines
826 B
JavaScript
35 lines
826 B
JavaScript
import { URL } from "url";
|
|
import { readFileSync, writeFileSync } from "fs";
|
|
|
|
const versionFilePath = new URL(
|
|
"../../params/version.go",
|
|
import.meta.url
|
|
).pathname;
|
|
|
|
const versionFileContent = readFileSync(versionFilePath, { encoding: "utf-8" });
|
|
|
|
const currentVersionPatch = versionFileContent.match(
|
|
/VersionPatch = (?<patch>\d+)/
|
|
).groups.patch;
|
|
|
|
try {
|
|
parseInt(currentVersionPatch);
|
|
} catch (err) {
|
|
console.error(new Error("Failed to parse version in version.go file"));
|
|
throw err;
|
|
}
|
|
|
|
// prettier-ignore
|
|
const newVersionPatch = `${parseInt(currentVersionPatch) + 1}`;
|
|
|
|
console.log(
|
|
`Bump version from ${currentVersionPatch} to ${newVersionPatch}`
|
|
);
|
|
|
|
writeFileSync(
|
|
versionFilePath,
|
|
versionFileContent.replace(
|
|
`VersionPatch = ${currentVersionPatch}`,
|
|
`VersionPatch = ${newVersionPatch}`
|
|
)
|
|
);
|