actions: mock binaries for the build

This commit is contained in:
Tyler Wilding 2022-04-16 01:08:46 -04:00
parent 00a3457bb7
commit 95926ad62c
No known key found for this signature in database
GPG key ID: A89403EB356ED106
3 changed files with 25 additions and 1 deletions

View file

@ -40,6 +40,7 @@ jobs:
- name: install app dependencies and build it
run: |
npm ci
npm run mock-bin
npm run build
- uses: tauri-apps/tauri-action@v0

View file

@ -12,7 +12,8 @@
"package": "node ./scripts/rename-binaries.js",
"update-bin": "node ./scripts/update-binaries.js && npm run package",
"lint": "npx prettier --check .",
"format": "npx prettier --write ."
"format": "npx prettier --write .",
"mock-bin": "node ./scripts/dummy-binaries.js"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.30",

22
scripts/dummy-binaries.js Normal file
View file

@ -0,0 +1,22 @@
/**
* Used for builds / CI to basically mock the install process
*
* If Tauri can't find the binaries, it will fail (maybe there is a better way to ignore this though)
*/
import { existsSync, rmdirSync, mkdirSync, writeFileSync } from "fs";
// Clear our current binaries
if (existsSync("./src-tauri/bin")) {
rmdirSync("./src-tauri/bin", { recursive: true, force: true });
}
// Recreate the directory
mkdirSync("./src-tauri/bin");
// Create empty executables
let extension = "";
if (process.platform === "win32") {
extension = ".exe";
}
writeFileSync(`./src-tauri/bin/extractor${extension}`, "dummy");
writeFileSync(`./src-tauri/bin/gk${extension}`, "dummy");
writeFileSync(`./src-tauri/bin/goalc${extension}`, "dummy");