Skip to content

Commit 3bd5cc1

Browse files
committed
更新工作流
1 parent 0ae6e92 commit 3bd5cc1

1 file changed

Lines changed: 83 additions & 8 deletions

File tree

.github/workflows/manual-release.yml

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,80 @@ permissions:
3030
contents: write
3131

3232
jobs:
33+
publish-tauri:
34+
# 添加输出定义
35+
outputs:
36+
appVersion: ${{ steps.set_output.outputs.appVersion }}
37+
permissions:
38+
contents: write
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
include:
43+
- platform: 'macos-latest'
44+
args: '--target aarch64-apple-darwin'
45+
- platform: 'macos-latest'
46+
args: '--target x86_64-apple-darwin'
47+
- platform: 'ubuntu-24.04'
48+
args: ''
49+
- platform: 'windows-latest'
50+
args: ''
51+
52+
runs-on: ${{ matrix.platform }}
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: lts/*
60+
61+
- name: Install Rust stable
62+
uses: dtolnay/rust-toolchain@stable
63+
with:
64+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
65+
66+
- name: Install dependencies (ubuntu only)
67+
if: matrix.platform == 'ubuntu-24.04'
68+
run: |
69+
sudo apt-get update
70+
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
71+
72+
- name: Install frontend dependencies
73+
run: npm install
74+
75+
- uses: tauri-apps/tauri-action@v0
76+
id: tauri-action # 添加 id 以便后续引用
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
80+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
81+
with:
82+
tagName: tauri-demo-v__VERSION__
83+
releaseName: 'tauri-demo v__VERSION__'
84+
releaseBody: 'See the assets to download this version and install.'
85+
releaseDraft: false # 不创建草稿版本
86+
prerelease: false # 不作为预发布版本
87+
args: ${{ matrix.args }}
88+
89+
# 增加获取版本号
90+
- name: Generate release tag
91+
id: save_tag
92+
if: matrix.platform == 'ubuntu-24.04'
93+
run: |
94+
# 调试输出
95+
echo ${{ steps.tauri-action.outputs.appVersion }}
96+
# 输出到步骤级
97+
echo "appVersion=${{ steps.tauri-action.outputs.appVersion }}" >> $GITHUB_OUTPUT
98+
99+
# 设置作业级输出
100+
- name: Set job output
101+
id: set_output
102+
if: matrix.platform == 'ubuntu-24.04'
103+
run: |
104+
# 注意:这里引用的是 save_tag 步骤的 tag_name 输出
105+
echo "appVersion=${{ steps.save_tag.outputs.appVersion }}" >> $GITHUB_OUTPUT
106+
33107
build-ubuntu:
34108
if: ${{ contains(github.event.inputs.platforms, 'all') || contains(github.event.inputs.platforms, 'ubuntu') }}
35109
runs-on: ubuntu-22.04
@@ -268,15 +342,16 @@ jobs:
268342
draft: false
269343
prerelease: ${{ github.event.inputs.prerelease }}
270344

271-
upgradelink-upload:
272-
needs: release
273-
if: always() && needs.release.result == 'success'
274-
runs-on: ubuntu-22.04
345+
upgradeLink-upload:
346+
needs: publish-tauri # 依赖于 publish-tauri作业完成
347+
permissions:
348+
contents: write
349+
runs-on: ubuntu-latest
275350
steps:
276-
- name: Send update to UpgradeLink
351+
- name: Send a request to UpgradeLink
277352
uses: toolsetlink/upgradelink-action@v5
278353
with:
279-
source-url: 'https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/latest.json'
280-
access-key: ${{ secrets.UPGRADE_LINK_ACCESS_KEY }}
281-
tauri-key: ${{ secrets.UPGRADE_LINK_TAURI_KEY }}
354+
source-url: 'https://github.com/toolsetlink/tauri-demo/releases/download/tauri-demo-v${{ needs.publish-tauri.outputs.appVersion }}/latest.json'
355+
access-key: ${{ secrets.UPGRADE_LINK_ACCESS_KEY }} # ACCESS_KEY 密钥key
356+
tauri-key: ${{ secrets.UPGRADE_LINK_TAURI_KEY }} # TAURI_KEY tauri 应用唯一标识
282357
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)