post-version.mjs 664 B

123456789101112131415161718192021222324
  1. import fs from "fs-extra";
  2. import { createRequire } from "module";
  3. import { execSync } from "child_process";
  4. const require = createRequire(import.meta.url);
  5. // update the tauri conf version
  6. async function resolveVersion() {
  7. const { version } = require("../package.json");
  8. const tauri = require("../src-tauri/tauri.conf.json");
  9. tauri.package.version = version;
  10. await fs.writeFile(
  11. "./src-tauri/tauri.conf.json",
  12. JSON.stringify(tauri, undefined, 2)
  13. );
  14. execSync("git add ./src-tauri/tauri.conf.json");
  15. execSync(`git commit -m v${version} --no-verify`);
  16. execSync(`git push`);
  17. execSync(`git push origin v${version}`);
  18. }
  19. resolveVersion();