Publish Release / publish (push) Has been cancelled
- Add `.gitea/release-config.json` to define conventional commit types and changelog sections - Add `.gitea/workflows/publish.yml` to automate version bumping, changelog generation, and Windows builds - Update `AUTOMATED_RELEASE.md` to reflect migration from GitHub Actions to Gitea Actions - Update documentation to specify Windows-only builds and Gitea Release creation - Add Gitea Token configuration instructions for repository setup - Configure workflow to run on main branch pushes with concurrency controls - Set up automated asset uploads for Windows executables and update files
69 lines
2.3 KiB
Markdown
69 lines
2.3 KiB
Markdown
# 自动化发布流程
|
||
|
||
本项目配置了自动化的发布流程,包括自动版本更新和变更日志生成。以下是相关说明:
|
||
|
||
## 工作流程
|
||
|
||
当代码合并到 main 分支后,Gitea Actions 会自动执行以下步骤:
|
||
|
||
1. 检出代码
|
||
2. 设置 Node.js 和 pnpm 环境
|
||
3. 安装依赖
|
||
4. 根据 Git 提交信息自动更新版本号
|
||
5. 生成变更日志 (CHANGELOG.md)
|
||
6. 构建应用程序 (Windows 平台)
|
||
7. 创建 Gitea 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` 配置定义了版本管理和变更日志生成规则
|
||
- `.gitea/workflows/publish.yml` 包含了自动化发布的工作流程定义
|
||
|
||
## 重要说明
|
||
|
||
1. 为了使自动化发布正常工作,必须在 Gitea 仓库设置中配置 `GITEA_TOKEN` secret,用于推送代码和创建 Release。
|
||
2. 构建过程会生成适用于 Windows 平台的应用程序包。
|
||
3. 变更日志会自动包含在 Gitea Release 中。
|
||
|
||
## Gitea Token 配置
|
||
|
||
在 Gitea 仓库的 Settings -> Secrets 中添加以下 secret:
|
||
|
||
- `GITEA_TOKEN`: 具有仓库写入权限的访问令牌,可在 Gitea 用户设置 -> 应用 -> 管理访问令牌中创建
|