From 6da182f2f2cbfc1a9e547b4c42f07e37a6d609ea Mon Sep 17 00:00:00 2001 From: Sparkenstein Date: Fri, 12 Jul 2024 14:06:49 +0530 Subject: [PATCH] fix: upx script --- .github/workflows/release.yml | 10 ++++++++-- package.json | 5 +++-- scripts/compress.mjs | 11 +++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e82e3c9..1eba3ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,9 +35,15 @@ jobs: # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. # You can remove the one that doesn't apply to your app to speed up the workflow a bit. + - name: Install package manager (from package.json) + run: | + corepack enable + corepack install + - name: setup node uses: actions/setup-node@v4 with: + node-version-file: package.json node-version: lts/* cache: "yarn" # Set this to npm, yarn or pnpm. @@ -57,9 +63,9 @@ jobs: - name: Install UPX if: matrix.settings.platform != 'macos-latest' - uses: crazy-max/ghaction-upx@v2 + uses: crazy-max/ghaction-upx@v3 with: - version: latest + install-only: true - uses: tauri-apps/tauri-action@v0 env: diff --git a/package.json b/package.json index 21d1136..86a5dba 100644 --- a/package.json +++ b/package.json @@ -113,5 +113,6 @@ "rollup-plugin-visualizer": "^5.12.0", "typescript": "^5.4.3", "vite": "^5.2.7" - } -} + }, + "packageManager": "yarn@1.22.22" +} diff --git a/scripts/compress.mjs b/scripts/compress.mjs index 7913655..ccd1269 100644 --- a/scripts/compress.mjs +++ b/scripts/compress.mjs @@ -12,7 +12,7 @@ function findBinary(dir) { const stat = fs.statSync(filePath); if (stat.isDirectory()) { // ignore - } else if (file === "dev-tool" || file.includes("dev-tools.exe")) { + } else if (file === "dev-tools" || file === "dev-tools.exe") { return filePath; } } @@ -23,6 +23,13 @@ const targetDir = path.join(".", "src-tauri", "target", "release"); const binaryPath = findBinary(targetDir); if (binaryPath) { + // check if current OS is darwin + + let osname = process.platform; + if (osname === "darwin") { + console.log("OS is darwin, skipping UPX compression"); + process.exit(0); + } console.log(`Found binary: ${binaryPath}`); try { execSync(`upx --best --lzma "${binaryPath}"`); @@ -33,5 +40,5 @@ if (binaryPath) { } } else { console.error("Binary not found"); - process.exit(1); + process.exit(0); }