Files

160 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

# 打包与发布指南
本文档介绍如何构建和发布 CutThenThink Lite 应用程序。
## 系统要求
### 通用要求
- Node.js 18+
- npm 或 yarn
- Rust 1.70+ (用于 Tauri)
### Linux
```bash
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.0-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf
```
### macOS
- Xcode 命令行工具
- macOS 10.13+
### Windows
- Microsoft C++ Build Tools
- WebView2 Runtime (通常已预装)
## 快速开始
### 1. 安装依赖
```bash
npm install
```
### 2. 构建应用
```bash
npm run build
npm run tauri:build
```
### 3. 开发模式
```bash
npm run tauri:dev
```
## 使用脚本
### 完整构建
```bash
./scripts/build.sh
```
### 开发构建
```bash
./scripts/dev.sh
```
### 仅打包前端
```bash
./scripts/package-frontend.sh
```
## 构建输出
构建完成后,打包文件位于:
- Linux: `src-tauri/target/release/bundle/`
- macOS: `src-tauri/target/release/bundle/dmg/`
- Windows: `src-tauri/target/release/bundle/nsis/`
### Linux 打包格式
- `.AppImage` - 通用 Linux 应用格式
- `.deb` - Debian/Ubuntu 包
- `.tar.gz` - 源代码压缩包
### macOS 打包格式
- `.dmg` - 磁盘映像
- `.app` - 应用程序包
### Windows 打包格式
- `.exe` - NSIS 安装程序
- `.msi` - MSI 安装程序
## CI/CD
项目使用 GitHub Actions 进行自动化构建:
- `.github/workflows/build.yml` - 发布构建
- `.github/workflows/test.yml` - 测试构建
触发构建:
```bash
git tag v0.1.0
git push origin v0.1.0
```
## 数字签名
### Windows
需要代码签名证书来避免 Windows SmartScreen 警告。
### macOS
需要 Apple Developer 账户来签名应用。
## 发布检查清单
- [ ] 更新版本号 (package.json, tauri.conf.json)
- [ ] 更新 CHANGELOG.md
- [ ] 创建 Git 标签
- [ ] 推送标签到远程仓库
- [ ] 等待 CI/CD 构建
- [ ] 下载并测试构建产物
- [ ] 创建 GitHub Release
- [ ] 上传构建产物到 Release
- [ ] 更新应用商店(如适用)
## 故障排除
### 构建失败
1. 清理缓存:
```bash
npm run clean
cargo clean
```
2. 重新安装依赖:
```bash
rm -rf node_modules
npm install
```
3. 检查 Rust 版本:
```bash
rustc --version
```
### Linux 依赖问题
如果遇到 GTK 或 WebKit 相关错误,请确保安装了所有依赖:
```bash
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev
```
### 图标未显示
确保图标文件位于 `src-tauri/icons/` 目录:
- 32x32.png
- 128x128.png
- 128x128@2x.png
- icon.icns (macOS)
- icon.ico (Windows)
## 许可证
MIT License - 详见 LICENSE 文件