Skip to content

Commit 09b727c

Browse files
committed
ci: release workflow
1 parent aad00c0 commit 09b727c

File tree

2 files changed

+478
-0
lines changed

2 files changed

+478
-0
lines changed

.github/workflows/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# GitHub Actions Workflows
2+
3+
## Release Workflow
4+
5+
自动发布 release 的 workflow,支持生成详细的 changelog、emoji 标记和贡献者 @。
6+
7+
### 功能特性
8+
9+
- ✨ 自动生成详细的 changelog
10+
- 🎨 根据 commit 类型自动添加对应的 emoji
11+
- 👥 自动识别并 @ 所有贡献者
12+
- 📝 支持 Conventional Commits 格式
13+
14+
### 触发方式
15+
16+
当推送以 `v` 开头的 tag 时自动触发:
17+
18+
```bash
19+
git tag v1.0.0
20+
git push origin v1.0.0
21+
```
22+
23+
### Commit 格式
24+
25+
推荐使用 [Conventional Commits](https://www.conventionalcommits.org/) 格式:
26+
27+
```
28+
<type>(<scope>): <subject>
29+
30+
<body>
31+
32+
<footer>
33+
```
34+
35+
### 支持的 Commit 类型和 Emoji
36+
37+
| 类型 | Emoji | 说明 |
38+
|------|-------|------|
39+
| `feat` || 新功能 |
40+
| `fix` | 🐛 | Bug 修复 |
41+
| `docs` | 📝 | 文档更新 |
42+
| `style` | 💄 | 代码格式(不影响代码运行) |
43+
| `refactor` | ♻️ | 重构(既不是新功能也不是 bug 修复) |
44+
| `perf` || 性能优化 |
45+
| `test` || 测试相关 |
46+
| `build` | 🔨 | 构建系统或外部依赖变更 |
47+
| `ci` | 👷 | CI 配置文件和脚本变更 |
48+
| `chore` | 🔧 | 其他变更(不修改 src 或 test 文件) |
49+
| `revert` || 回退 |
50+
| `security` | 🔒 | 安全相关 |
51+
| `deps` | 📦 | 依赖更新 |
52+
| `config` | ⚙️ | 配置变更 |
53+
| `types` | 🏷️ | 类型定义 |
54+
| `i18n` | 🌐 | 国际化 |
55+
| `ui` | 🎨 | UI 相关 |
56+
| `ux` | 💡 | 用户体验 |
57+
| `api` | 🔌 | API 相关 |
58+
| `db` | 🗄️ | 数据库相关 |
59+
| `docker` | 🐳 | Docker 相关 |
60+
| `release` | 🚀 | 发布相关 |
61+
62+
### 示例
63+
64+
#### Commit 示例
65+
66+
```bash
67+
git commit -m "feat: 添加用户登录功能"
68+
git commit -m "fix: 修复登录页面的样式问题"
69+
git commit -m "docs: 更新 README 文档"
70+
```
71+
72+
#### 发布 Release
73+
74+
```bash
75+
# 1. 确保所有更改都已提交
76+
git add .
77+
git commit -m "chore: 准备发布 v1.0.0"
78+
79+
# 2. 创建并推送 tag
80+
git tag v1.0.0
81+
git push origin v1.0.0
82+
83+
# 3. GitHub Actions 会自动创建 release
84+
```
85+
86+
### Changelog 格式
87+
88+
生成的 changelog 会按照以下格式组织:
89+
90+
```markdown
91+
# Release Notes - v1.0.0
92+
93+
## ✨ New Features
94+
- ✨ 添加用户登录功能
95+
- ✨ 添加用户注册功能
96+
97+
## 🐛 Bug Fixes
98+
- 🐛 修复登录页面的样式问题
99+
- 🐛 修复注册表单验证错误
100+
101+
## 👥 Contributors
102+
103+
- @username1 (Author Name)
104+
- @username2
105+
- Author Name
106+
107+
感谢所有贡献者! 🙏
108+
```
109+
110+
### 注意事项
111+
112+
1. **Tag 格式**: Tag 必须以 `v` 开头,例如 `v1.0.0``v2.1.3`
113+
2. **Commit 格式**: 建议使用 Conventional Commits 格式以获得更好的分类
114+
3. **贡献者识别**: Workflow 会尝试通过 email 和作者名查找 GitHub 用户名,如果找不到则显示作者名
115+
4. **权限**: 需要 `contents: write` 权限来创建 release
116+
117+
### 自定义
118+
119+
如果需要修改 emoji 映射或添加新的 commit 类型,可以编辑 `.github/workflows/release.yml` 文件中的 `EMOJI_MAP` 部分。
120+

0 commit comments

Comments
 (0)