语义发布重大更改使用 ! (感叹号)

Dav*_*wys 12 semantic-release conventional-commits conventional-changelog

可以使用感叹号在语义发布中处理主要版本更改(也称为重大更改)吗?

\n
git commit -m \'feat!: this is breaking, but is not recognized by semantic-release\'\n
Run Code Online (Sandbox Code Playgroud)\n

传统的提交指南表明,可以在页脚中使用页眉中的感叹号来标记重大更改。

\n

在此输入图像描述

\n

这是我一直在测试的工作流程

\n

安装存储库 \xe2\x9c\x93

\n
git init\ngit remote add origin git@github.com:klueless-io/k_genesis.git\ngit branch -M main\ngit add .\ngit commit -am \'first commit\'\n# Artificial starting version number\ngit tag v0.0.18 -a -m \'k_genesis initialize repository\'\ngit push -u origin main --tags\ngit hist\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n

删除单个文件并将其称为新功能 \xe2\x9c\x93

\n
rm a1\ngit add .\ngit commit -m \'feat: remove a1\'\ngit hist\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n
npx semantic-release --no-ci\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n
git hist\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n

现在使用页脚消息 \xe2\x9c\x93 进行重大更改

\n
\n

这没有按预期工作

\n
\n
rm a2\ngit add .\ngit commit -m \'feat: removed a2   \n\nBREAKING CHANGE: break dancing\n\'\ngit hist\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n
git hist\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n

到目前为止看起来不错 \xe2\x9c\x93

\n

在此输入图像描述

\n

现在尝试使用 ! 感叹号 \xe2\x9c\x97 :( :( :(

\n
rm a2\ngit add .\ngit commit -m \'feat: removed a2   \n\nBREAKING CHANGE: break dancing\n\'\ngit hist\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n
npx semantic-release --no-ci\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n
git hist\n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n
rm a3\ngit add .\ngit commit -m \'feat!: removed a3 with exclamation in header\'   \n
Run Code Online (Sandbox Code Playgroud)\n

在此输入图像描述

\n

尝试自定义配置

\n

我已经使用了“@semantic-release/commit-analyzer”( Angular )的默认预设,并且尝试了自定义预设(conventioncommits

\n

我的.releaserc

\n
npx semantic-release --no-ci\n# Analysis of 1 commits complete: no release\n
Run Code Online (Sandbox Code Playgroud)\n

查看源代码

\n

当我查看源代码convention-changelog-conventionalcommits时,它似乎应该支持标头中的重大更改。

\n

在此输入图像描述

\n

Cod*_*rut 1

您需要手动配置它.releaserc

YAML

branches:
  - main
plugins:
  - - "@semantic-release/commit-analyzer"
    - preset: conventionalcommits
      releaseRules:
        - type: '*!'
          release: major
Run Code Online (Sandbox Code Playgroud)

JSON

{
  "branches": [
    "main"
  ],
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "preset": "conventionalcommits",
        "releaseRules": [
          {
            "type": "*!",
            "release": "major"
          }
        ]
      }
    ]
  ]
}
Run Code Online (Sandbox Code Playgroud)