From aef93ef821edb112682a92b37a329f5aba1d4fad Mon Sep 17 00:00:00 2001 From: opti1337 Date: Tue, 23 Dec 2025 20:50:13 +0600 Subject: [PATCH] update --- .gitea/workflows/deploy-client.yml | 9 +++---- client/Dockerfile.windows | 2 ++ client/scripts/generate-updater.mjs | 41 +++++++++++++++++++++++++++++ client/src-tauri/tauri.conf.json | 4 +-- 4 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 client/scripts/generate-updater.mjs diff --git a/.gitea/workflows/deploy-client.yml b/.gitea/workflows/deploy-client.yml index f4cb0d0..5404c56 100644 --- a/.gitea/workflows/deploy-client.yml +++ b/.gitea/workflows/deploy-client.yml @@ -2,11 +2,9 @@ name: Deploy on: push: - # branches: - # - release - # tags: - # - "v[0-9]+.[0-9]+.[0-9]+" - # + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + paths: - ".gitea/workflows/deploy-client.yml" - "client/**" @@ -46,7 +44,6 @@ jobs: with: files: | nsis/** - body: "New version" draft: true # publish-web: diff --git a/client/Dockerfile.windows b/client/Dockerfile.windows index 6036e25..a14e3a4 100644 --- a/client/Dockerfile.windows +++ b/client/Dockerfile.windows @@ -35,4 +35,6 @@ RUN cargo install --locked cargo-xwin RUN yarn tauri build --runner cargo-xwin --target x86_64-pc-windows-msvc +RUN node scripts/generate-updater.js + RUN ls -la diff --git a/client/scripts/generate-updater.mjs b/client/scripts/generate-updater.mjs new file mode 100644 index 0000000..0a14901 --- /dev/null +++ b/client/scripts/generate-updater.mjs @@ -0,0 +1,41 @@ +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) + +const TAURI_CONF = path.resolve(__dirname, '../src-tauri/tauri.conf.json') +const OUTPUT = path.resolve(__dirname, '../updater.json') + +const PLATFORM = 'windows-x86_64' +const BASE_URL = 'https://git.koptilnya.xyz/opti1337/chad/releases/download/latest' + +const tauriConfRaw = fs.readFileSync(TAURI_CONF, 'utf8') +const tauriConf = JSON.parse(tauriConfRaw) +const version = tauriConf.package.version + +const SIG_FILE = path.resolve( + __dirname, + `../src-tauri/target/release/bundle/nsis/chad_${version}_x64-setup.exe.sig`, +) + +const signature = fs.readFileSync(SIG_FILE, 'utf8').trim() + +const installerName = `chad_${version}_x64-setup.exe` + +const updater = { + pub_date: new Date().toISOString(), + version, + platforms: { + [PLATFORM]: { + url: `${BASE_URL}/${installerName}`, + signature, + }, + }, + notes: '', +} + +fs.writeFileSync(OUTPUT, JSON.stringify(updater, null, 2), 'utf8') + +console.log('updater.json generated') diff --git a/client/src-tauri/tauri.conf.json b/client/src-tauri/tauri.conf.json index 4b095e9..569d9a4 100644 --- a/client/src-tauri/tauri.conf.json +++ b/client/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "chad", - "version": "0.2.5-rc.2", + "version": "0.2.6", "identifier": "xyz.koptilnya.chad", "build": { "frontendDist": "../.output/public", @@ -46,7 +46,7 @@ "updater": { "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEU3MzkxMzM3RkQ3NTg4QUQKUldTdGlIWDlOeE01NStIak9VbmZTTm9HY2NyNUQrVXB5ZEdIN1BkK2lhYW9zWkNCQnZQSjRmelIK", "endpoints": [ - "https://git.koptilnya.xyz/opti1337/chad/releases/download/latest/latest.json" + "https://git.koptilnya.xyz/opti1337/chad/releases/download/latest/updater.json" ] } }