ci: enable updater only when tag

main
spacemeowx2 2023-04-21 22:09:00 +08:00
parent c4242e9f66
commit e1737f7c30
3 changed files with 17 additions and 2 deletions

View File

@ -62,6 +62,10 @@ jobs:
with: with:
projectPath: ./gui 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 - name: Release the app
uses: tauri-apps/tauri-action@v0 uses: tauri-apps/tauri-action@v0
if: ${{ startsWith(github.ref, 'refs/tags/gui-v') }} if: ${{ startsWith(github.ref, 'refs/tags/gui-v') }}

View File

@ -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));
}

View File

@ -72,8 +72,9 @@
"csp": null "csp": null
}, },
"updater": { "updater": {
"active": true, "active": false,
"endpoints": [ "endpoints": [
"https://s3si-update.imspace.cn/v1/{{target}}/{{arch}}/{{current_version}}",
"https://gist.githubusercontent.com/spacemeowx2/a67078487d3450b75927953f6edc14e2/raw/update-request.json" "https://gist.githubusercontent.com/spacemeowx2/a67078487d3450b75927953f6edc14e2/raw/update-request.json"
], ],
"dialog": true, "dialog": true,
@ -92,4 +93,4 @@
} }
] ]
} }
} }