Skip to content

Commit 0e72098

Browse files
committed
Fix release workflow platform builds
1 parent 649581e commit 0e72098

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,40 @@ jobs:
7676
- name: Install dependencies
7777
run: npm ci
7878

79-
- name: Build
79+
- name: Prepare updater signing key
80+
shell: bash
81+
run: |
82+
if [ -z "${TAURI_SIGNING_PRIVATE_KEY:-}" ]; then
83+
echo "TAURI_SIGNING_PRIVATE_KEY secret is required" >&2
84+
exit 1
85+
fi
86+
node - <<'NODE'
87+
const key = process.env.TAURI_SIGNING_PRIVATE_KEY.trim();
88+
const decoded = Buffer.from(key, 'base64').toString('utf8');
89+
const firstLine = decoded.split(/\r?\n/, 1)[0] || '';
90+
91+
if (!firstLine.startsWith('untrusted comment:')) {
92+
console.error('TAURI_SIGNING_PRIVATE_KEY must be the full content of .updater/file-share.key.');
93+
process.exit(1);
94+
}
95+
96+
if (firstLine.includes('public key')) {
97+
console.error('TAURI_SIGNING_PRIVATE_KEY is a public key. Use .updater/file-share.key, not .updater/file-share.key.pub.');
98+
process.exit(1);
99+
}
100+
101+
if (!firstLine.includes('secret key')) {
102+
console.error('TAURI_SIGNING_PRIVATE_KEY is not an updater secret key.');
103+
process.exit(1);
104+
}
105+
NODE
106+
printf '%s' "$TAURI_SIGNING_PRIVATE_KEY" > "$RUNNER_TEMP/tauri-signing.key"
80107
env:
81108
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
109+
110+
- name: Build
111+
env:
112+
TAURI_SIGNING_PRIVATE_KEY_PATH: ${{ runner.temp }}/tauri-signing.key
82113
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
83114
run: npm run build -- ${{ matrix.build_args }}
84115

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ npm run dev
4040

4141
启动后会打开 Tauri 管理端窗口。输入端口并点击“启动服务”后,客户端才可以通过局域网地址访问。
4242

43-
桌面端在 macOS 菜单栏和 Windows 系统托盘中提供后台入口。关闭窗口不会退出应用,需要通过托盘菜单里的“退出”真正关闭。
43+
桌面端在 macOS 菜单栏和 Windows 系统托盘中提供后台入口。
4444

4545
开发模式说明:
4646

@@ -60,7 +60,7 @@ npm run build
6060

6161
GitHub Actions 发布前,需要在仓库 Settings -> Secrets and variables -> Actions 中添加:
6262

63-
- `TAURI_SIGNING_PRIVATE_KEY``.updater/file-share.key` 的完整内容
63+
- `TAURI_SIGNING_PRIVATE_KEY``.updater/file-share.key` 的原始完整内容,直接复制文件里的 base64 字符串,不要解码,也不要使用 `.updater/file-share.key.pub`
6464
- `TAURI_SIGNING_PRIVATE_KEY_PASSWORD`:如果私钥设置了密码再填写;当前生成的私钥没有密码,可以不填
6565

6666
## 自动发布

src-tauri/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ use tauri::{
77
image::Image,
88
menu::{Menu, MenuItem},
99
tray::{TrayIcon, TrayIconBuilder},
10-
ActivationPolicy, AppHandle, Emitter, Manager, RunEvent, WindowEvent, Wry,
10+
AppHandle, Emitter, Manager, RunEvent, WindowEvent, Wry,
1111
};
12+
#[cfg(target_os = "macos")]
13+
use tauri::ActivationPolicy;
1214

1315
const DEFAULT_PORT: u16 = 5421;
1416
const TRAY_TOGGLE_SHARE_ID: &str = "toggle-share";

0 commit comments

Comments
 (0)