Skip to content

Commit de31093

Browse files
committed
Merge branch 'upgradeLink' into release
2 parents fef9fe1 + b356a92 commit de31093

10 files changed

Lines changed: 354 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
npm run build:py-mac
7777
7878
- uses: tauri-apps/tauri-action@v0
79+
id: tauri-action # 添加 id 以便后续引用
7980
env:
8081
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8182
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
@@ -84,6 +85,38 @@ jobs:
8485
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
8586
releaseName: "v__VERSION__"
8687
releaseBody: "See the assets to download this version and install."
87-
releaseDraft: true
88-
prerelease: false
88+
releaseDraft: false # 不创建草稿版本
89+
prerelease: false # 不作为预发布版本
8990
args: ${{ matrix.args }}
91+
92+
# 增加获取版本号
93+
- name: Generate release tag
94+
id: save_tag
95+
if: matrix.platform == 'ubuntu-24.04'
96+
run: |
97+
# 调试输出
98+
echo ${{ steps.tauri-action.outputs.appVersion }}
99+
# 输出到步骤级
100+
echo "appVersion=${{ steps.tauri-action.outputs.appVersion }}" >> $GITHUB_OUTPUT
101+
102+
# 设置作业级输出
103+
- name: Set job output
104+
id: set_output
105+
if: matrix.platform == 'ubuntu-24.04'
106+
run: |
107+
# 注意:这里引用的是 save_tag 步骤的 tag_name 输出
108+
echo "appVersion=${{ steps.save_tag.outputs.appVersion }}" >> $GITHUB_OUTPUT
109+
110+
upgradeLink-upload:
111+
needs: publish-tauri # 依赖于 publish-tauri作业完成
112+
permissions:
113+
contents: write
114+
runs-on: ubuntu-latest
115+
steps:
116+
- name: Send a request to UpgradeLink
117+
uses: toolsetlink/upgradelink-action@v5
118+
with:
119+
source-url: "https://github.com/lanxiuyun/lazyeat/releases/download/v${{ needs.publish-tauri.outputs.appVersion }}/latest.json"
120+
access-key: ${{ secrets.UPGRADE_LINK_ACCESS_KEY }} # ACCESS_KEY 密钥key
121+
tauri-key: ${{ secrets.UPGRADE_LINK_TAURI_KEY }} # TAURI_KEY tauri 应用唯一标识
122+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/upgradelink.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: 'publish'
2+
3+
# on:
4+
# push:
5+
# branches:
6+
# - main
7+
8+
jobs:
9+
publish-tauri:
10+
# 添加输出定义
11+
outputs:
12+
appVersion: ${{ steps.set_output.outputs.appVersion }}
13+
14+
permissions:
15+
contents: write
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- platform: 'macos-latest'
21+
args: '--target aarch64-apple-darwin'
22+
- platform: 'macos-latest'
23+
args: '--target x86_64-apple-darwin'
24+
- platform: 'ubuntu-24.04'
25+
args: ''
26+
- platform: 'windows-latest'
27+
args: ''
28+
29+
runs-on: ${{ matrix.platform }}
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: pnpm/action-setup@v4
34+
with:
35+
version: 9
36+
run_install: true
37+
38+
- name: setup node
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: lts/*
42+
cache: 'pnpm'
43+
44+
- name: install Rust stable
45+
uses: dtolnay/rust-toolchain@stable
46+
with:
47+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
48+
49+
- name: install dependencies (ubuntu only)
50+
if: matrix.platform == 'ubuntu-24.04'
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install pkg-config libclang-dev libxcb1-dev libxrandr-dev libdbus-1-dev libpipewire-0.3-dev libwayland-dev libegl-dev libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev libgbm-dev libappindicator3-dev librsvg2-dev patchelf
54+
55+
- name: install frontend dependencies
56+
run: pnpm install
57+
58+
- uses: tauri-apps/tauri-action@v0
59+
id: tauri-action # 添加 id 以便后续引用
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
63+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
64+
with:
65+
tagName: tauri-demo-v__VERSION__
66+
releaseName: 'tauri-demo v__VERSION__'
67+
releaseBody: 'See the assets to download this version and install.'
68+
releaseDraft: false # 不创建草稿版本
69+
prerelease: false # 不作为预发布版本
70+
args: ${{ matrix.args }}
71+
72+
# 增加获取版本号
73+
- name: Generate release tag
74+
id: save_tag
75+
if: matrix.platform == 'ubuntu-24.04'
76+
run: |
77+
# 调试输出
78+
echo ${{ steps.tauri-action.outputs.appVersion }}
79+
# 输出到步骤级
80+
echo "appVersion=${{ steps.tauri-action.outputs.appVersion }}" >> $GITHUB_OUTPUT
81+
82+
# 设置作业级输出
83+
- name: Set job output
84+
id: set_output
85+
if: matrix.platform == 'ubuntu-24.04'
86+
run: |
87+
# 注意:这里引用的是 save_tag 步骤的 tag_name 输出
88+
echo "appVersion=${{ steps.save_tag.outputs.appVersion }}" >> $GITHUB_OUTPUT
89+
90+
upgradeLink-upload:
91+
needs: publish-tauri # 依赖于 publish-tauri作业完成
92+
permissions:
93+
contents: write
94+
runs-on: ubuntu-latest
95+
steps:
96+
- name: Send a request to UpgradeLink
97+
uses: toolsetlink/upgradelink-action@v5
98+
with:
99+
source-url: 'https://github.com/toolsetlink/tauri-demo/releases/download/tauri-demo-v${{ needs.publish-tauri.outputs.appVersion }}/latest.json'
100+
access-key: ${{ secrets.UPGRADE_LINK_ACCESS_KEY }} # ACCESS_KEY 密钥key
101+
tauri-key: ${{ secrets.UPGRADE_LINK_TAURI_KEY }} # TAURI_KEY tauri 应用唯一标识
102+
github-token: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@tauri-apps/plugin-autostart": "^2.2.0",
2323
"@tauri-apps/plugin-notification": "^2.2.2",
2424
"@tauri-apps/plugin-opener": "^2.2.6",
25+
"@tauri-apps/plugin-process": "^2.3.0",
2526
"@tauri-apps/plugin-store": "^2.2.0",
2627
"@tauri-apps/plugin-updater": "^2.9.0",
2728
"@tauri-apps/plugin-window-state": "^2.2.1",

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ serde_json = "1"
2525
tauri-plugin-shell = "2"
2626
tauri-plugin-store = "2"
2727
tauri-plugin-notification = "2"
28+
tauri-plugin-process = "2"
2829

2930
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
3031
tauri-plugin-autostart = "2"

src-tauri/capabilities/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"core:window:allow-set-position",
3939
"core:window:allow-set-size",
4040

41-
"updater:default"
41+
"updater:default",
42+
"process:default"
4243
]
4344
}

src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use tauri_plugin_shell::ShellExt;
3232
#[cfg_attr(mobile, tauri::mobile_entry_point)]
3333
pub fn run() {
3434
tauri::Builder::default()
35+
.plugin(tauri_plugin_process::init())
3536
.plugin(tauri_plugin_updater::Builder::new().build())
3637
.plugin(tauri_plugin_notification::init())
3738
// .plugin(tauri_plugin_window_state::Builder::new().build()) // 窗口状态管理,启用了导致 sub-window 无法设置decorations

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"dangerousInsecureTransportProtocol": true,
6767
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEI4QUFERUNDNkU2RkFBQjgKUldTNHFtOXV6TjZxdUU1TjgrazZVMWNPNVNKNzZENHJQQkhYbytKbWMvZERQWkFoOG9qSDZkNEYK",
6868
"endpoints": [
69-
"https://github.com/lanxiuyun/lazyeat/releases/latest/download/latest.json"
69+
"https://api.upgrade.toolsetlink.com/v1/tauri/upgrade?tauriKey=zY0JIMn9x6W7vCs4P1mtgQ&versionName={{current_version}}&appointVersionName=&devModelKey=&devKey=&target={{target}}&arch={{arch}}"
7070
],
7171
"windows": {
7272
"installMode": "passive"

src/App.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<template>
22
<router-view />
3+
<UpdaterNotification />
34
</template>
45

6+
<script lang="ts" setup>
7+
import UpdaterNotification from "@/components/updaterNotification.vue";
8+
</script>
9+
510
<style lang="scss">
611
html,
712
body {

0 commit comments

Comments
 (0)