- Introduced a new release configuration file to define commit types and sections for changelog generation. - Created a publish workflow to automate the release process on main branch pushes, including version bumping, changelog generation, and GitHub release creation. - Added a separate release workflow to build artifacts for multiple platforms and upload them as release assets. - Documented the automated release process, including commit message conventions and local release commands in AUTOMATED_RELEASE.md.
61 lines
2.1 KiB
Markdown
61 lines
2.1 KiB
Markdown
# 自动化发布流程
|
|
|
|
本项目配置了自动化的发布流程,包括自动版本更新和变更日志生成。以下是相关说明:
|
|
|
|
## 工作流程
|
|
|
|
当代码合并到 main 分支后,GitHub Actions 会自动执行以下步骤:
|
|
|
|
1. 检出代码
|
|
2. 设置 Node.js 和 pnpm 环境
|
|
3. 安装依赖
|
|
4. 根据 Git 提交信息自动更新版本号
|
|
5. 生成变更日志 (CHANGELOG.md)
|
|
6. 构建应用程序 (所有平台)
|
|
7. 创建 GitHub Release
|
|
8. 上传构建产物
|
|
|
|
## 提交信息规范
|
|
|
|
为了确保自动版本管理和变更日志生成正常工作,提交信息必须遵循约定格式:
|
|
|
|
- `feat: ...` - 添加新功能,触发 MINOR 版本更新
|
|
- `fix: ...` - 修复错误,触发 PATCH 版本更新
|
|
- `perf: ...` - 性能改进,触发 PATCH 版本更新
|
|
- `docs: ...` - 文档更新,不触发版本更新
|
|
- `style: ...` - 代码格式调整,不触发版本更新
|
|
- `refactor: ...` - 重构代码,不触发版本更新
|
|
- `test: ...` - 测试相关,不触发版本更新
|
|
- `build: ...` - 构建系统或依赖更新,可能触发版本更新
|
|
- `ci: ...` - CI 配置更新,不触发版本更新
|
|
- `chore: ...` - 其他杂项,不触发版本更新
|
|
|
|
示例:
|
|
- `feat: 添加用户认证功能`
|
|
- `fix: 修复登录页面的错误`
|
|
- `docs: 更新 API 文档`
|
|
|
|
## 本地版本发布
|
|
|
|
如果需要在本地手动执行发布流程,可运行以下命令:
|
|
|
|
```bash
|
|
# 根据提交历史自动发布新版本
|
|
pnpm release
|
|
|
|
# 手动指定发布类型
|
|
pnpm release:major # 主版本更新 (1.x.x -> 2.x.x)
|
|
pnpm release:minor # 次版本更新 (1.1.x -> 1.2.x)
|
|
pnpm release:patch # 补丁更新 (1.1.1 -> 1.1.2)
|
|
```
|
|
|
|
## 配置文件
|
|
|
|
- `.versionrc.json` 或 `package.json` 中的 `standard-version` 配置定义了版本管理和变更日志生成规则
|
|
- `.github/workflows/publish.yml` 包含了自动化发布的工作流程定义
|
|
|
|
## 重要说明
|
|
|
|
1. 为了使自动化发布正常工作,必须正确配置 GitHub 仓库的 secrets,特别是用于发布构建产物的令牌。
|
|
2. 构建过程会生成适用于多个平台(Windows、macOS、Linux)的应用程序包。
|
|
3. 变更日志会自动包含在 GitHub Release 中。 |