cliff.toml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # git-cliff 配置文件
  2. # https://git-cliff.org/docs/configuration
  3. #
  4. # 以 "#" 开头的行是注释。
  5. # 配置选项按表和键组织。
  6. # 更多可用选项请参阅文档。
  7. [changelog]
  8. # 变更日志的标题模板
  9. header = """
  10. # GoHUB 项目主要提供的是 Web 服务, 且具备命令行功能
  11. Web 服务功能会封装到子命令 serve 中,命令行功能会封装到子命令 cli 中。
  12. ## 除了 serve 命令,我们还会有以下命令
  13. 1. key 命令生成 app key
  14. 2. make 命令
  15. 3. seed 数据填充
  16. 4. migrate 数据库迁移
  17. 5. cache 缓存处理
  18. 6. 数据库迁移
  19. ## 数据库迁移
  20. 使用 go-migrate 进行数据库迁移,支持多种数据库。
  21. 数据库迁移文件位于 database/migrations 目录下,文件名为 timestamp_xxx.up.sql 或 timestamp_xxx.down.sql。
  22. timestamp 为时间戳, xxx 为迁移的名称, up 为执行迁移, down 为回滚迁移。
  23. 例如: 2024_04_17_150000_create_migrations_table.up.sql
  24. ```sql
  25. -- 表结构
  26. CREATE TABLE `migrations` (
  27. `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  28. `migration` varchar(255) NOT NULL,
  29. `batch` bigint DEFAULT NULL,
  30. PRIMARY KEY (`id`),
  31. UNIQUE KEY `migration` (`migration`)
  32. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
  33. ```
  34. 迁移的命令如下:\n
  35. 1. up —— 执行迁移
  36. 2. rollback (down) —— 回滚上一步执行的迁移
  37. 3. fresh —— 删除所有表,然后执行所有迁移
  38. 4. reset —— 回滚所有迁移
  39. 5. refresh —— 回滚所有迁移,然后再执行所有迁移
  40. ## 变更日志\n
  41. 本文件记录了本项目的所有重要变更。\n
  42. """
  43. # 变更日志的内容模板
  44. # https://keats.github.io/tera/docs/#introduction
  45. body = """
  46. {% if version %}\
  47. ### [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
  48. {% else %}\
  49. ### [未发布]
  50. {% endif %}\
  51. {% for group, commits in commits | group_by(attribute="group") %}
  52. #### {{ group | striptags | trim | upper_first }}
  53. {% for commit in commits %}
  54. - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
  55. {% if commit.breaking %}[**破坏性变更**] {% endif %}\
  56. {{ commit.message | upper_first }}\
  57. {% endfor %}
  58. {% endfor %}\n
  59. """
  60. # 变更日志的页脚模板
  61. footer = """
  62. <!-- 由 git-cliff 生成 -->
  63. """
  64. # 移除内容前后的空白
  65. trim = true
  66. # 后处理器
  67. postprocessors = [
  68. # { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # 替换仓库 URL
  69. ]
  70. # 即使没有发布版本也渲染内容
  71. render_always = true
  72. # 输出文件路径
  73. output = "CHANGELOG.md"
  74. [git]
  75. # 基于 https://www.conventionalcommits.org 解析提交信息
  76. conventional_commits = true
  77. # 过滤掉不符合规范的提交
  78. filter_unconventional = true
  79. # 将提交的每一行作为单独的提交处理
  80. split_commits = false
  81. # 提交信息的预处理正则表达式
  82. commit_preprocessors = [
  83. # 替换问题编号
  84. #{ pattern = '$(\w+\s)?#([0-9]+)$', replace = "([#${2}](<REPO>/issues/${2}))"},
  85. # 使用 https://github.com/crate-ci/typos 检查提交信息的拼写
  86. # 如果拼写错误,会自动修正。
  87. #{ pattern = '.*', replace_command = 'typos --write-changes -' },
  88. ]
  89. # 提交信息的解析和分组规则
  90. commit_parsers = [
  91. { message = "^feat", group = "🚀 新功能" },
  92. { message = "^fix", group = "🐛 Bug 修复" },
  93. { message = "^docs", group = "📚 文档更新" },
  94. { message = "^style", group = "🎨 代码样式" },
  95. { message = "^refactor", group = "🚜 代码重构" },
  96. { message = "^perf", group = "⚡ 性能优化" },
  97. { message = "^test", group = "🧪 测试相关" },
  98. { message = "^build", group = "📦 构建系统" },
  99. { message = "^ci", group = "🔧 CI 配置" },
  100. { message = "^chore", group = "⚙️ 辅助工具的变动" },
  101. { message = "^revert", group = "◀️ 回滚变更" },
  102. { message = "^security", group = "🛡️ 安全相关" },
  103. { message = "^wip", group = "🚧 进行中" },
  104. { message = "^deps", group = "📦 依赖更新" },
  105. { message = "^init", group = "🎉 初始化" },
  106. { message = "^config", group = "⚙️ 配置变更" },
  107. { message = "^release", group = "🏷️ 版本发布" },
  108. { message = "^hotfix", group = "🔥 紧急修复" },
  109. { message = "^breaking", group = "💥 破坏性变更" },
  110. { message = ".*", group = "💼 其他" },
  111. ]
  112. # 过滤掉未被提交解析器匹配的提交
  113. filter_commits = false
  114. # 按拓扑顺序排序标签
  115. topo_order = true
  116. # 按提交时间排序(oldest 或 newest)
  117. sort_commits = "newest"