Skip to content

Commit 3fd4509

Browse files
committed
feat: 添加 CI/CD 发布流水线和 GitHub 协作模板
- 添加 GitHub Actions 工作流,监听标签推送自动构建发布 - 添加 Bug Report 和 Feature Request Issue 模板 - 添加 Pull Request 模板
1 parent 88252ef commit 3fd4509

9 files changed

Lines changed: 425 additions & 0 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Bug Report
2+
description: 报告一个 Bug 问题
3+
title: '[Bug] '
4+
labels: ['bug']
5+
body:
6+
- type: textarea
7+
id: description
8+
attributes:
9+
label: 问题描述
10+
description: 请清晰简洁地描述遇到的问题
11+
placeholder: 描述发生了什么问题...
12+
validations:
13+
required: true
14+
15+
- type: textarea
16+
id: steps
17+
attributes:
18+
label: 复现步骤
19+
description: 请提供复现该问题的步骤
20+
placeholder: |
21+
1. 打开 '...'
22+
2. 点击 '...'
23+
3. 滚动到 '...'
24+
4. 看到错误
25+
validations:
26+
required: true
27+
28+
- type: textarea
29+
id: expected
30+
attributes:
31+
label: 期望行为
32+
description: 请描述您期望发生的行为
33+
placeholder: 本来应该...
34+
validations:
35+
required: true
36+
37+
- type: textarea
38+
id: actual
39+
attributes:
40+
label: 实际行为
41+
description: 请描述实际发生的行为
42+
placeholder: 实际上...
43+
validations:
44+
required: true
45+
46+
- type: input
47+
id: browser
48+
attributes:
49+
label: 浏览器版本
50+
description: 请提供浏览器类型和版本
51+
placeholder: 'Chrome 120.0.6099.109'
52+
validations:
53+
required: true
54+
55+
- type: input
56+
id: os
57+
attributes:
58+
label: 操作系统
59+
description: 请提供操作系统信息
60+
placeholder: 'macOS 14.2 / Windows 11 / Ubuntu 22.04'
61+
validations:
62+
required: true
63+
64+
- type: textarea
65+
id: screenshots
66+
attributes:
67+
label: 截图
68+
description: 如果适用,请添加截图帮助解释问题
69+
placeholder: 拖拽图片到此处...
70+
71+
- type: textarea
72+
id: additional
73+
attributes:
74+
label: 其他信息
75+
description: 添加任何其他关于问题的信息
76+
placeholder: 其他相关信息...

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 查看文档
4+
url: https://github.com/xie392/CodeFrame#readme
5+
about: 请先查看 README 了解项目基本信息
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Feature Request
2+
description: 提出一个新功能建议
3+
title: '[Feature] '
4+
labels: ['enhancement']
5+
body:
6+
- type: textarea
7+
id: description
8+
attributes:
9+
label: 功能描述
10+
description: 请清晰简洁地描述您想要的功能
11+
placeholder: 我希望添加...
12+
validations:
13+
required: true
14+
15+
- type: textarea
16+
id: scenario
17+
attributes:
18+
label: 使用场景
19+
description: 请描述这个功能在什么场景下会用到
20+
placeholder: |
21+
作为一个用户,我希望...以便于...
22+
validations:
23+
required: true
24+
25+
- type: textarea
26+
id: solution
27+
attributes:
28+
label: 期望解决方案
29+
description: 请描述您期望的解决方案或实现方式
30+
placeholder: 可以通过...实现...
31+
32+
- type: textarea
33+
id: alternatives
34+
attributes:
35+
label: 替代方案
36+
description: 请描述您考虑过的替代方案
37+
placeholder: 我也考虑过...
38+
39+
- type: textarea
40+
id: additional
41+
attributes:
42+
label: 其他信息
43+
description: 添加任何其他关于功能请求的信息
44+
placeholder: 其他相关信息...

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## 变更描述
2+
3+
<!-- 请简洁描述本次 PR 的变更内容 -->
4+
5+
## 变更类型
6+
7+
- [ ] 新功能 (feat)
8+
- [ ] Bug 修复 (fix)
9+
- [ ] 文档更新 (docs)
10+
- [ ] 代码格式 (style)
11+
- [ ] 重构 (refactor)
12+
- [ ] 测试 (test)
13+
- [ ] 构建/工具 (chore)
14+
15+
## 变更内容
16+
17+
<!-- 列出具体的变更项 -->
18+
19+
-
20+
21+
## 测试清单
22+
23+
- [ ] 本地测试通过
24+
- [ ] `pnpm lint` 通过
25+
- [ ] `pnpm test` 通过
26+
- [ ] `pnpm build` 通过
27+
28+
## 截图对比(如适用)
29+
30+
<!-- 如果是 UI 变更,请提供变更前后的截图 -->
31+
32+
| 变更前 | 变更后 |
33+
| ------ | ------ |
34+
| | |
35+
36+
## 其他信息
37+
38+
<!-- 添加任何其他相关信息 -->

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: 9
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'pnpm'
26+
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Build extension
31+
run: pnpm build
32+
33+
- name: Get version from tag
34+
id: version
35+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
36+
37+
- name: Create zip archive
38+
run: |
39+
cd dist
40+
zip -r ../codeframe-${{ steps.version.outputs.VERSION }}.zip .
41+
cd ..
42+
43+
- name: Create GitHub Release
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
name: CodeFrame ${{ steps.version.outputs.VERSION }}
47+
files: codeframe-${{ steps.version.outputs.VERSION }}.zip
48+
generate_release_notes: true
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## 上下文
2+
3+
CodeFrame 是一个 Chrome 扩展项目,当前通过 `pnpm build` 构建到 `dist` 目录。
4+
用户需要手动打包 dist 目录才能安装扩展。项目托管在 GitHub,但缺乏自动化发布流程。
5+
6+
## 目标 / 非目标
7+
8+
**目标:**
9+
- 标签推送时自动构建并生成 zip 压缩包
10+
- 自动创建 GitHub Release 并附上构建产物
11+
- 提供标准化的 Issue 和 PR 模板
12+
13+
**非目标:**
14+
- Chrome Web Store 自动发布(需要 API 密钥和付费开发者账号)
15+
- 多环境部署(dev/staging/production)
16+
- 自动化测试流水线(本次仅关注构建和发布)
17+
18+
## 决策
19+
20+
### CI/CD 方案:GitHub Actions
21+
22+
**选择原因:**
23+
- 与 GitHub 原生集成,无需额外服务
24+
- 公开仓库免费无限制
25+
- 支持标签触发、产物上传
26+
27+
**触发条件:**
28+
- 推送 `v*` 格式标签(如 `v1.0.0`
29+
30+
**构建产物命名:**
31+
- `codeframe-{version}.zip`(如 `codeframe-1.0.0.zip`
32+
33+
### Issue 模板格式:YAML 表单
34+
35+
**选择原因:**
36+
- GitHub 原生支持 YAML 格式表单
37+
- 结构化数据便于筛选和统计
38+
- 用户体验优于纯 Markdown
39+
40+
**模板类型:**
41+
1. Bug Report - 问题报告
42+
2. Feature Request - 功能请求
43+
44+
### PR 模板格式:Markdown
45+
46+
**选择原因:**
47+
- PR 内容自由度较高,Markdown 更灵活
48+
- 支持任务清单勾选
49+
50+
## 风险 / 权衡
51+
52+
| 风险 | 缓解措施 |
53+
|------|----------|
54+
| 标签格式错误导致流水线失败 | 使用正则校验,文档说明格式规范 |
55+
| 构建产物过大 | 压缩前清理不必要的文件(如 .map) |
56+
57+
## 待决问题
58+
59+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# 变更:添加 CI/CD 流水线和 GitHub 协作模板
2+
3+
## 为什么
4+
5+
项目目前缺乏自动化构建和发布流程,每次发布需要手动打包。同时缺少标准化的 Issue 和 PR 模板,
6+
影响协作效率和问题追踪质量。
7+
8+
## 变更内容
9+
10+
### CI/CD 流水线
11+
- 添加 GitHub Actions 工作流,监听标签推送自动触发构建
12+
- 自动打包扩展为 zip 压缩包
13+
- 构建产物自动发布到 GitHub Releases
14+
15+
### 协作模板
16+
- 添加 Bug Report Issue 模板
17+
- 添加 Feature Request Issue 模板
18+
- 添加 Pull Request 模板
19+
20+
## 影响
21+
22+
- 受影响规范:新增 `cicd` 规范
23+
- 新增文件:
24+
- `.github/workflows/release.yml` - 发布工作流
25+
- `.github/ISSUE_TEMPLATE/bug_report.yml` - Bug 报告模板
26+
- `.github/ISSUE_TEMPLATE/feature_request.yml` - 功能请求模板
27+
- `.github/PULL_REQUEST_TEMPLATE.md` - PR 模板

0 commit comments

Comments
 (0)