NapCatQQ/script/checkVersion.cjs

14 lines
884 B
JavaScript
Raw Normal View History

2024-04-16 04:41:18 +00:00
let fs = require("fs");
let process = require("process")
console.log("[NapCat] [CheckVersion] 开始检测当前仓库版本...");
2024-04-16 04:46:37 +00:00
let currentVersion = require("../package.json").version;
2024-04-16 04:41:18 +00:00
let targetVersion = process.env.VERSION;
console.log("[NapCat] [CheckVersion] currentVersion:", currentVersion, " targetVersion:", targetVersion);
2024-04-16 04:51:12 +00:00
// fs.mkdirSync("./dist");
2024-04-16 04:41:18 +00:00
if (currentVersion === targetVersion) {
2024-04-16 05:06:07 +00:00
fs.writeFileSync("./checkVersion.sh", "#!/bin/bashe\necho \"CheckVersion Is Done\"")
2024-04-16 04:41:18 +00:00
} else {
2024-04-16 05:47:42 +00:00
let runscript = "sed -i 's/\"version\": \"" + currentVersion + "\"/\"version\": \"" + targetVersion + "\"/g' package.json";
2024-04-16 05:50:01 +00:00
fs.writeFileSync("./checkVersion.sh", "#!/bin/bashe\ngit config --global user.email \"bot@test.nanaeo.cn\"\n git config --global user.name \"Version\"\n" + runscript + "\ngit add .\n git commit -m \"chore:version change\"\n git push -u origin main")
2024-04-16 04:41:18 +00:00
}