0

在我的节点项目中 - 我正在尝试实现语义发布以生成变更日志形式的发布说明,增加项目版本号。

按照以下命令在项目中安装相同的内容:

npm i -D semantic-release@next @semantic-release/git@next @semantic-release/commit-analyzer@next @semantic-release/release-notes-generator@next @semantic-release/npm@next @semantic-release/changelog@next

这是package.json文件中的配置:

"release": {
    "branches": [
      "qa"
    ],
    "plugins": [
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator",
      "@semantic-release/changelog",
      "@semantic-release/git"
    ]
  }

但是,当我尝试运行时npx semantic-release --no-ci,它会抛出这个:

此测试运行是在分支 qa 上触发的,而语义发布配置为仅从 master 发布,因此不会发布新版本。

整个堆栈跟踪是:

ℹ  Running semantic-release version 15.14.0
✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
✔  Loaded plugin "prepare" from "@semantic-release/changelog"
✔  Loaded plugin "prepare" from "@semantic-release/git"
ℹ  This test run was triggered on the branch qa, while semantic-release is configured to only publish from master, therefore a new version won’t be published.

常规提交是在 QA 分支上完成的——我需要在 QA 分支上生成变更日志。

什么是正确的方法?

4

1 回答 1

1

我不是 100% 确定,但增强的分支定义是:

branches: [
  {name: 'qa', prerelease: false}
]

由于使用--branch标志时会生成更改日志,因此配置文件中的分支定义可能是错误的。

您可以尝试使用我建议的增强语句来配置分支。

于 2021-10-11T13:01:25.867 回答