From e1737f7c30bbf46691fe4abc08ce511ddcbb5488 Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Fri, 21 Apr 2023 22:09:00 +0800 Subject: [PATCH] ci: enable updater only when tag --- .github/workflows/gui.yaml | 4 ++++ gui/scripts/enable-updater.ts | 10 ++++++++++ gui/src-tauri/tauri.conf.json | 5 +++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 gui/scripts/enable-updater.ts diff --git a/.github/workflows/gui.yaml b/.github/workflows/gui.yaml index 58fda5f..1758758 100644 --- a/.github/workflows/gui.yaml +++ b/.github/workflows/gui.yaml @@ -62,6 +62,10 @@ jobs: with: projectPath: ./gui + - name: Prepare to release the app + if: ${{ startsWith(github.ref, 'refs/tags/gui-v') }} + run: deno run -A ./gui/scripts/enable-updater.ts + - name: Release the app uses: tauri-apps/tauri-action@v0 if: ${{ startsWith(github.ref, 'refs/tags/gui-v') }} diff --git a/gui/scripts/enable-updater.ts b/gui/scripts/enable-updater.ts new file mode 100644 index 0000000..e67c6d1 --- /dev/null +++ b/gui/scripts/enable-updater.ts @@ -0,0 +1,10 @@ +import * as path from "https://deno.land/std@0.178.0/path/mod.ts"; + +if (import.meta.main) { + const __dirname = path.dirname(path.fromFileUrl(import.meta.url)); + const tauriConf = path.join(__dirname, '../src-tauri/tauri.conf.json'); + const tauriConfContent = await Deno.readTextFile(tauriConf); + const tauriConfJson = JSON.parse(tauriConfContent); + tauriConfJson.tauri.updater.active = true; + await Deno.writeTextFile(tauriConf, JSON.stringify(tauriConfJson, null, 2)); +} diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.json index dfc7c73..8609f0f 100644 --- a/gui/src-tauri/tauri.conf.json +++ b/gui/src-tauri/tauri.conf.json @@ -72,8 +72,9 @@ "csp": null }, "updater": { - "active": true, + "active": false, "endpoints": [ + "https://s3si-update.imspace.cn/v1/{{target}}/{{arch}}/{{current_version}}", "https://gist.githubusercontent.com/spacemeowx2/a67078487d3450b75927953f6edc14e2/raw/update-request.json" ], "dialog": true, @@ -92,4 +93,4 @@ } ] } -} \ No newline at end of file +}