From 92fc09493e0e41272b9291e599ba6e613de4a224 Mon Sep 17 00:00:00 2001 From: GyDi Date: Mon, 27 Dec 2021 23:07:56 +0800 Subject: [PATCH] chore: post version script --- scripts/post-version.mjs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/post-version.mjs diff --git a/scripts/post-version.mjs b/scripts/post-version.mjs new file mode 100644 index 0000000..d6750a7 --- /dev/null +++ b/scripts/post-version.mjs @@ -0,0 +1,24 @@ +import fs from "fs-extra"; +import { createRequire } from "module"; +import { execSync } from "child_process"; + +const require = createRequire(import.meta.url); + +// update the tauri conf version +async function resolveVersion() { + const { version } = require("../package.json"); + const tauri = require("../src-tauri/tauri.conf.json"); + + tauri.package.version = version; + + await fs.writeFile( + "./src-tauri/tauri.conf.json", + JSON.stringify(tauri, undefined, 2) + ); + execSync("git add ./src-tauri/tauri.conf.json"); + execSync(`git commit -m v${version} --no-verify`); + execSync(`git push`); + execSync(`git push origin v${version}`); +} + +resolveVersion();