From 58ca3df64f81f04e4d41045f84801868d2dfa272 Mon Sep 17 00:00:00 2001 From: KC <48410934+orangelckc@users.noreply.github.com> Date: Sun, 26 Mar 2023 22:58:18 +0200 Subject: [PATCH] feat: add auto updater (#105) --- .github/workflows/release.yml | 12 +++++++----- package.json | 4 ++-- src-tauri/Cargo.lock | 23 ++++++++++++++++++++++- src-tauri/Cargo.toml | 4 ++-- src-tauri/tauri.conf.json | 13 +++++++------ 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0f3047..cb074ac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ permissions: on: push: tags: - - 'v*' + - "v*" workflow_dispatch: jobs: @@ -59,13 +59,13 @@ jobs: - name: Rust cache uses: swatinem/rust-cache@v2 with: - workspaces: './src-tauri -> target' + workspaces: "./src-tauri -> target" - name: Sync node version and setup cache uses: actions/setup-node@v3 with: - node-version: '16' - cache: 'pnpm' + node-version: "16" + cache: "pnpm" - name: Install app dependencies and build web run: pnpm install --frozen-lockfile @@ -74,9 +74,11 @@ jobs: uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: "" with: tagName: ${{ github.ref_name }} releaseName: ChatGPT-Desktop ${{ needs.create-release.outputs.APP_VERSION }} - releaseBody: '' + releaseBody: "" releaseDraft: true prerelease: false diff --git a/package.json b/package.json index 03ee999..f8d75ae 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ChatGPT-Desktop", + "name": "chatgpt-desktop", "private": true, "version": "0.0.7", "type": "module", @@ -70,4 +70,4 @@ "vite": "^4.0.0", "vue-tsc": "^1.0.11" } -} +} \ No newline at end of file diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 996c641..cd7197a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -409,7 +409,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chat_gpt" -version = "1.0.0" +version = "0.0.8" dependencies = [ "serde", "serde_json", @@ -1833,6 +1833,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "minisign-verify" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -3391,6 +3397,7 @@ checksum = "fe7e0f1d535e7cbbbab43c82be4fc992b84f9156c16c160955617e0260ebc449" dependencies = [ "anyhow", "attohttpc", + "base64 0.13.1", "cocoa", "dirs-next", "embed_plist", @@ -3403,6 +3410,7 @@ dependencies = [ "heck 0.4.1", "http", "ignore", + "minisign-verify", "notify-rust", "objc", "once_cell", @@ -3428,12 +3436,14 @@ dependencies = [ "tauri-utils", "tempfile", "thiserror", + "time", "tokio", "url", "uuid 1.3.0", "webkit2gtk", "webview2-com", "windows 0.39.0", + "zip", ] [[package]] @@ -4606,6 +4616,17 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zip" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0445d0fbc924bb93539b4316c11afb121ea39296f99a3c4c9edad09e3658cdef" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", +] + [[package]] name = "zvariant" version = "3.12.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index f4536e1..f84de26 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chat_gpt" -version = "1.0.0" +version = "0.0.8" description = "ChatGPT-Desktop" authors = ["orangelckc", "bilibili-ayang"] license = "MIT" @@ -13,7 +13,7 @@ edition = "2021" tauri-build = { version = "1.2", features = [] } [dependencies] -tauri = { version = "1.2", features = ["api-all", "macos-private-api", "system-tray"] } +tauri = { version = "1.2", features = ["api-all", "macos-private-api", "system-tray", "updater"] } tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 192ef58..94a1543 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -43,11 +43,7 @@ "icons/icon.icns", "icons/icon.ico" ], - "targets": [ - "deb", - "msi", - "dmg" - ], + "targets": "all", "identifier": "com.ChatGPT-Desktop", "macOS": { "entitlements": null, @@ -71,7 +67,12 @@ "csp": null }, "updater": { - "active": false + "active": true, + "dialog": true, + "endpoints": [ + "https://updater-two.vercel.app/update/{{target}}/{{current_version}}" + ], + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDhDRkYzMDc2NTFGRTQ5MTIKUldRU1NmNVJkakQvaklIVnpidTB5TVBwUXlFOTI1WkJwS0h4YTJScEdxQ0lzRkFnQUhDQ3pnM28K" }, "windows": [ {