From a5db950b2e836306c3cd302e9b8c8837299d4b29 Mon Sep 17 00:00:00 2001 From: Borber Date: Tue, 16 Jan 2024 14:48:31 +0800 Subject: [PATCH] Adjust compilation script --- .github/workflows/release.yml | 1 + script/built.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c766733..9e09b9c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,6 +85,7 @@ jobs: - name: Built env: MATRIX_LANG: ${{ matrix.lang }} + MATRIX_PLATFORM: ${{ matrix.platform }} run: deno run -A script/built.ts - name: Upload release assets diff --git a/script/built.ts b/script/built.ts index 6f275d9..012f723 100644 --- a/script/built.ts +++ b/script/built.ts @@ -2,6 +2,9 @@ import { ensureDir } from "https://deno.land/std@0.207.0/fs/mod.ts"; const dirs = ["msi", "nsis", "deb", "appimage", "dmg", "macos",] +let system = Deno.env.get("MATRIX_PLATFORM") +system = system?.split("-")[0] + const lang = Deno.env.get("MATRIX_LANG") const root = "src-tauri/target/release" const bundle = root + "/bundle" @@ -13,11 +16,13 @@ for (const dir of dirs) { ensureDir(`${bundle}/${dir}`).then(async () => { if (Deno.statSync(`${bundle}/${dir}`).isDirectory) { for await (const file of Deno.readDir(`${bundle}/${dir}`)) { - if (file.isFile && file.name.startsWith("Tran")) { + if (file.isFile && (file.name.startsWith("Tran") || file.name.startsWith("tran"))) { let name = file.name + console.log("old:" + `${bundle}/${dir}/${file.name}`) name = name.replace("Tran", "Tran" + "_" + lang) + name = name.replace("tran", "Tran" + "_" + lang) await Deno.copyFile(`${bundle}/${dir}/${file.name}`, `release/${name}`) - console.log(`release/${name}`) + console.log("new:" + `release/${name}`) } } } @@ -28,7 +33,7 @@ for (const dir of dirs) { for await (const file of Deno.readDir(root)) { let name = file.name if (name == "Tran.exe" || name == "Tran") { - name = name.replace("Tran", "Tran" + "_" + lang + "_portable") + name = name.replace("Tran", "Tran" + "_" + lang + "_portable_" + system) await Deno.copyFile(`${root}/${file.name}`, `release/${name}`) console.log(`release/${name}`) }