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 }}
0 commit comments