1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-25 03:32:54 +01:00
client/scripts/tauri-version.js
2023-12-21 18:22:43 -05:00

24 lines
816 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;
const GITHUB_RUN_ATTEMPT = process.env.GITHUB_RUN_ATTEMPT;
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));