Skip to content

Commit

Permalink
updater crap
Browse files Browse the repository at this point in the history
  • Loading branch information
Puyodead1 committed Dec 21, 2023
1 parent ecc15d1 commit 6c769e5
Show file tree
Hide file tree
Showing 8 changed files with 949 additions and 179 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
"url": "git+https://github.com/spacebarchat/client.git"
},
"scripts": {
"build": "tsc && vite build",
"build": "npm run ci:prebuild && tsc && vite build",
"ci:prebuild": "node scripts/tauri-version.js",
"dev": "vite",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "pnpx prettier . --write",
Expand Down
23 changes: 23 additions & 0 deletions scripts/tauri-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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));
2 changes: 1 addition & 1 deletion src-tauri/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/

version.json
Loading

0 comments on commit 6c769e5

Please sign in to comment.