| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- # git-cliff 配置文件
- # https://git-cliff.org/docs/configuration
- #
- # 以 "#" 开头的行是注释。
- # 配置选项按表和键组织。
- # 更多可用选项请参阅文档。
- [changelog]
- # 变更日志的标题模板
- header = """
- # GoHUB 项目主要提供的是 Web 服务, 且具备命令行功能
- Web 服务功能会封装到子命令 serve 中,命令行功能会封装到子命令 cli 中。
- ## 除了 serve 命令,我们还会有以下命令
- 1. key 命令生成 app key
- 2. make 命令
- 3. seed 数据填充
- 4. migrate 数据库迁移
- 5. cache 缓存处理
- 6. 数据库迁移
- ## 数据库迁移
- 使用 go-migrate 进行数据库迁移,支持多种数据库。
- 数据库迁移文件位于 database/migrations 目录下,文件名为 timestamp_xxx.up.sql 或 timestamp_xxx.down.sql。
- timestamp 为时间戳, xxx 为迁移的名称, up 为执行迁移, down 为回滚迁移。
- 例如: 2024_04_17_150000_create_migrations_table.up.sql
- ```sql
- -- 表结构
- CREATE TABLE `migrations` (
- `id` bigint unsigned NOT NULL AUTO_INCREMENT,
- `migration` varchar(255) NOT NULL,
- `batch` bigint DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `migration` (`migration`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
- ```
- 迁移的命令如下:\n
- 1. up —— 执行迁移
- 2. rollback (down) —— 回滚上一步执行的迁移
- 3. fresh —— 删除所有表,然后执行所有迁移
- 4. reset —— 回滚所有迁移
- 5. refresh —— 回滚所有迁移,然后再执行所有迁移
- ## 变更日志\n
- 本文件记录了本项目的所有重要变更。\n
- """
- # 变更日志的内容模板
- # https://keats.github.io/tera/docs/#introduction
- body = """
- {% if version %}\
- ### [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
- {% else %}\
- ### [未发布]
- {% endif %}\
- {% for group, commits in commits | group_by(attribute="group") %}
- #### {{ group | striptags | trim | upper_first }}
- {% for commit in commits %}
- - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
- {% if commit.breaking %}[**破坏性变更**] {% endif %}\
- {{ commit.message | upper_first }}\
- {% endfor %}
- {% endfor %}\n
- """
- # 变更日志的页脚模板
- footer = """
- <!-- 由 git-cliff 生成 -->
- """
- # 移除内容前后的空白
- trim = true
- # 后处理器
- postprocessors = [
- # { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # 替换仓库 URL
- ]
- # 即使没有发布版本也渲染内容
- render_always = true
- # 输出文件路径
- output = "CHANGELOG.md"
- [git]
- # 基于 https://www.conventionalcommits.org 解析提交信息
- conventional_commits = true
- # 过滤掉不符合规范的提交
- filter_unconventional = true
- # 将提交的每一行作为单独的提交处理
- split_commits = false
- # 提交信息的预处理正则表达式
- commit_preprocessors = [
- # 替换问题编号
- #{ pattern = '$(\w+\s)?#([0-9]+)$', replace = "([#${2}](<REPO>/issues/${2}))"},
- # 使用 https://github.com/crate-ci/typos 检查提交信息的拼写
- # 如果拼写错误,会自动修正。
- #{ pattern = '.*', replace_command = 'typos --write-changes -' },
- ]
- # 提交信息的解析和分组规则
- commit_parsers = [
- { message = "^feat", group = "🚀 新功能" },
- { message = "^fix", group = "🐛 Bug 修复" },
- { message = "^docs", group = "📚 文档更新" },
- { message = "^style", group = "🎨 代码样式" },
- { message = "^refactor", group = "🚜 代码重构" },
- { message = "^perf", group = "⚡ 性能优化" },
- { message = "^test", group = "🧪 测试相关" },
- { message = "^build", group = "📦 构建系统" },
- { message = "^ci", group = "🔧 CI 配置" },
- { message = "^chore", group = "⚙️ 辅助工具的变动" },
- { message = "^revert", group = "◀️ 回滚变更" },
- { message = "^security", group = "🛡️ 安全相关" },
- { message = "^wip", group = "🚧 进行中" },
- { message = "^deps", group = "📦 依赖更新" },
- { message = "^init", group = "🎉 初始化" },
- { message = "^config", group = "⚙️ 配置变更" },
- { message = "^release", group = "🏷️ 版本发布" },
- { message = "^hotfix", group = "🔥 紧急修复" },
- { message = "^breaking", group = "💥 破坏性变更" },
- { message = ".*", group = "💼 其他" },
- ]
- # 过滤掉未被提交解析器匹配的提交
- filter_commits = false
- # 按拓扑顺序排序标签
- topo_order = true
- # 按提交时间排序(oldest 或 newest)
- sort_commits = "newest"
|