1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-21 18:02:32 +01:00
client/scripts/tauri-version.js
2023-12-21 19:44:42 -05:00

24 lines
842 B
JavaScript

import fs from "fs";
import path from "path";
import process from "process";
// if (!process.env.CI) {
// console.log("Not running in CI, skipping. Please do not run this script manually!");
// process.exit(0);
// }
const GITHUB_RUN_ID = process.env.GITHUB_RUN_ID || "0";
const GITHUB_RUN_ATTEMPT = process.env.GITHUB_RUN_ATTEMPT || "0";
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));