Skip to content

Commit

Permalink
Adjust compilation script
Browse files Browse the repository at this point in the history
  • Loading branch information
Borber committed Jan 16, 2024
1 parent ec1f51f commit a5db950
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions script/built.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { ensureDir } from "https://deno.land/[email protected]/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"
Expand All @@ -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}`)
}
}
}
Expand All @@ -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}`)
}
Expand Down

0 comments on commit a5db950

Please sign in to comment.