如何使用 major.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] [semantic-release] › ✖ ETAGNOVERSION Invalid
tagFormat
option. The tagFormat (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#tagformat) option must contain the variable version exactly once.Your configuration for the tagFormat option is ``.
[8:42:06 PM] [semantic-release] › ✖ EINVALIDTAGFORMAT Invalid
tagFormat
option. The tagFormat (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#tagformat) must compile to a valid Git reference (https://git-scm.com/docs/git-check-ref-format#_description).Your configuration for the tagFormat option is ``.
AggregateError: SemanticReleaseError: Invalid
tagFormat
option. at module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/get-error.js:6:10) at module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/verify.js:22:17) at async run (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:53:3) at async module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:259:22) at async module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/cli.js:55:5) SemanticReleaseError: InvalidtagFormat
option. at module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/get-error.js:6:10) at module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/verify.js:29:17) at async run (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:53:3) at async module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:259:22) at async module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/cli.js:55:5) at module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/lib/verify.js:41:11) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async run (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:53:3) at async module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/index.js:259:22) at async module.exports (/usr/local/lib/nodejs/node-v12.16.1-linux-x64/lib/node_modules/semantic-release/cli.js:55:5) { name: 'AggregateError' }npm ERR! code 1
当它说tagFormat选项是``时,就好像${version}被空格替换...
最佳答案
为了解决这个问题,我们在release.config.js配置文件中设置了tagFormat:
module.exports = {
...
tagFormat: '${version}',
....
}
关于git - 使用语义发布生成版本标签,不带 v,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66146949/