1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 02:12:38 +01:00
client/scripts/tauri-version.js

24 lines
842 B
JavaScript
Raw Permalink Normal View History

2023-12-22 00:22:43 +01:00
import fs from "fs";
import path from "path";
import process from "process";
2023-12-22 00:34:57 +01:00
// if (!process.env.CI) {
// console.log("Not running in CI, skipping. Please do not run this script manually!");
// process.exit(0);
// }
2023-12-22 00:22:43 +01:00
2023-12-22 01:44:42 +01:00
const GITHUB_RUN_ID = process.env.GITHUB_RUN_ID || "0";
const GITHUB_RUN_ATTEMPT = process.env.GITHUB_RUN_ATTEMPT || "0";
2023-12-22 00:22:43 +01:00
const GITHUB_REF_NAME = process.env.GITHUB_REF_NAME;
const pkgJsonPath = path.resolve("./package.json");
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
const pkgVersion = pkgJson.version;
// const tauriJsonPath = path.resolve("./src-tauri/tauri.conf.json");
const tauriJsonPath = path.resolve("./src-tauri/version.json");
const tauriJson = {
version: `${pkgVersion}+${GITHUB_RUN_ID}${GITHUB_RUN_ATTEMPT}`,
};
fs.writeFileSync(tauriJsonPath, JSON.stringify(tauriJson, null, 4));