feat(platform): 三端支持 —— Windows / Linux 已出包,macOS 走 Actions
老板要求:开发 macOS 和 Linux 版。
一、代码跨平台化(原来只能编 Windows)
· Cargo.toml:clipboard-win / windows-sys 挪到 [target.'cfg(windows)'.dependencies];
非 Windows 加 arboard(macOS 走 NSPasteboard,Linux 走 X11/Wayland)
· main.rs:
- windows_subsystem 属性加目标平台判断(mac/Linux 没这个概念)
- 剪贴板三个命令按平台分文件级实现
- 「复制文件本身」在 mac/Linux 退化为复制路径文本(这两个平台剪贴板没有
通用的文件格式,要写 NSPasteboard / GTK 私有 target,代价不值)
- reveal_in_explorer:explorer / open -R / xdg-open
- open_external:explorer / open / xdg-open
· 修了重构时误删的 message_box 命令(构建时才暴露,已核对 19 个命令齐全)
二、打包配置
· tauri icon 生成三端图标集(.ico / .icns / 多尺寸 png)
· bundle.targets = "all":win→nsis,mac→app+dmg,linux→deb+rpm+appimage
· macOS minimumSystemVersion 10.15;linux.deb 依赖声明
三、发布链路升级成多平台
· publish.py 重写:自动扫描 target 下**存在的**产物,按平台归位,
清单**合并**写入(在 Windows 发版不会冲掉 mac 的条目)
· 官网页新增 macOS / Linux 下载卡,按 latest.json 里有没有该平台决定显隐,
避免指向不存在的文件
四、实测(Linux 版)
· 本机装 webkit2gtk-4.1 等依赖后原生构建成功
· deb 2.79MB、AppImage 103.62MB(AppImage 自带 webkit 运行时所以大)
· 已发布:latest.json 现在有 windows-x86_64 + linux-x86_64 两个平台
· 官网 Linux 卡已显示,macOS 卡等有产物再自动出现
五、macOS
· .github/workflows/build.yml:macos-latest(arm64 + intel)/ ubuntu / windows 矩阵出包
· 需要仓库 Secrets 配升级签名私钥(和可选的苹果开发者证书)
This commit is contained in:
1 parent
580e875be5
commit
08f42cf1ce
61 files changed
+633
-109
No files matched your search
+35
-1
@@ -482,6 +482,26 @@
|
||||
</p>
|
||||
<a class="btn btn-line" data-dl="portable" href="/download/latest-portable.exe" download>下载便携版 .exe</a>
|
||||
</div>
|
||||
<div class="dl-card" data-plat="mac" hidden>
|
||||
<h3>macOS</h3>
|
||||
<div class="dl-size">.dmg · Apple Silicon / Intel</div>
|
||||
<p>
|
||||
拖进「应用程序」即可。未做苹果开发者签名,首次打开需<b>右键 → 打开</b>(或
|
||||
在终端执行 <code>xattr -dr com.apple.quarantine /Applications/XiaoyinMarkdown.app</code>)。
|
||||
</p>
|
||||
<a class="btn btn-line" data-dl="mac-arm" href="/download/latest-setup.exe" download>Apple Silicon</a>
|
||||
<a class="btn btn-line" data-dl="mac-x64" href="/download/latest-setup.exe" download style="margin-top:8px">Intel</a>
|
||||
</div>
|
||||
<div class="dl-card" data-plat="linux" hidden>
|
||||
<h3>Linux</h3>
|
||||
<div class="dl-size">AppImage / deb · x86_64</div>
|
||||
<p>
|
||||
AppImage 免安装,<code>chmod +x</code> 后双击即可;deb 适合 Debian / Ubuntu 系。
|
||||
需要系统里有 WebKitGTK 4.1。
|
||||
</p>
|
||||
<a class="btn btn-line" data-dl="linux-appimage" href="/download/latest-setup.exe" download>AppImage</a>
|
||||
<a class="btn btn-line" data-dl="linux-deb" href="/download/latest-setup.exe" download style="margin-top:8px">.deb</a>
|
||||
</div>
|
||||
<div class="dl-card">
|
||||
<h3>源码 / 旧版</h3>
|
||||
<div class="dl-size">Gitea · GitHub</div>
|
||||
@@ -546,13 +566,27 @@
|
||||
document.querySelectorAll('[data-ver]').forEach((el) => { el.textContent = m.version; });
|
||||
document.querySelectorAll('[data-notes]').forEach((el) => { el.textContent = m.notes || ''; });
|
||||
// 下载文件名带版本号:xymd_2.6.2.exe / xymd_2.6.2_portable.exe
|
||||
const map = { setup: `xymd_${m.version}.exe`, portable: `xymd_${m.version}_portable.exe` };
|
||||
const map = {
|
||||
setup: `xymd_${m.version}.exe`,
|
||||
portable: `xymd_${m.version}_portable.exe`,
|
||||
'mac-arm': `xymd_${m.version}_aarch64.dmg`,
|
||||
'mac-x64': `xymd_${m.version}_x64.dmg`,
|
||||
'linux-appimage': `xymd_${m.version}_amd64.AppImage`,
|
||||
'linux-deb': `xymd_${m.version}_amd64.deb`,
|
||||
};
|
||||
Object.entries(map).forEach(([kind, name]) => {
|
||||
document.querySelectorAll(`[data-dl="${kind}"]`).forEach((a) => {
|
||||
a.setAttribute('href', `/download/${name}`);
|
||||
a.setAttribute('download', name);
|
||||
});
|
||||
});
|
||||
// 清单里出现哪个平台,才显示那张下载卡(没构建过就不显示,避免 404)
|
||||
const plats = Object.keys(m.platforms || {});
|
||||
const has = (p) => plats.some((k) => k === p || k.startsWith(p));
|
||||
document.querySelectorAll('[data-plat]').forEach((el) => {
|
||||
const ok = el.dataset.plat === 'mac' ? has('darwin') : has('linux');
|
||||
el.hidden = !ok;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user