【问题标题】:generating version tags using semantic-release without the v使用不带 v 的语义发布生成版本标签
【发布时间】:2021-05-14 17:37:28
【问题描述】:

我如何使用格式为 ma​​jor.minor.patch 的 git 标签,而不使用 "v " 开头(即版本 1.0.1、2.0.1)?

我正在使用 Gitlab CI,但即使在本地使用 Docker 映像,我也无法将值正确传递给 tag-format

我正在尝试做的事情:

npx --no-install semantic-release --tag-format "\${version}"


错误日志:

[8:42:06 PM] [语义发布] › ✖ ETAGNOVERSION tagFormat 选项无效。 tagFormat (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#tagformat) 选项必须只包含一次变量版本。

您对 tagFormat 选项的配置是 ``.

[8:42:06 PM] [语义发布] › ✖ EINVALIDTAGFORMAT tagFormat 选项无效。 tagFormat (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#tagformat) 必须编译为有效的 Git 引用 (https://git-scm.com/docs/git-check-ref-format#_description)。

您对 tagFormat 选项的配置是 ``.

聚合错误: SemanticReleaseError:tagFormat 选项无效。 在 module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/get-error.js:6:10) 在 module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/verify.js:22:17) 在异步运行(/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:53:3) 在异步模块.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:259:22) 在异步模块.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/cli.js:55:5) SemanticReleaseError:tagFormat 选项无效。 在 module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/get-error.js:6:10) 在 module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/verify.js:29:17) 在异步运行(/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:53:3) 在异步模块.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:259:22) 在异步模块.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/cli.js:55:5) 在 module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/verify.js:41:11) 在 processTicksAndRejections (internal/process/task_queues.js:97:5) 在异步运行(/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:53:3) 在异步模块.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:259:22) 在 async module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/cli.js:55:5) { 名称:“聚合错误” }npm 错误!代码 1

当它说 tagFormat 选项是 `` 时,就好像 ${version} 正在被空白替换...

【问题讨论】:

  • 我不熟悉npx 代码,但它确实看起来像shell-eval-ed 两次。如果是这样的话,也许\\\$ 而不仅仅是\$ 可以解决问题。
  • 或者你也可以使用单引号来避免参数的任何shell解释。
  • 这个问题解决了吗?

标签: git continuous-integration gitlab gitlab-ci semantic-release


【解决方案1】:

为了解决这个问题,我们在 release.config.js 配置文件中设置了 tagFormat:

module.exports = {
    ...
    tagFormat: '${version}',
    ....
}

【讨论】:

    猜你喜欢
    • 2020-06-19
    • 2018-02-21
    • 1970-01-01
    • 2018-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-06
    相关资源
    最近更新 更多