generating version tags using semantic-release without the v

Viewed 1109

How can I use git tags with the format major.minor.patch, without the "v" in the beginning (i.e. versions 1.0.1, 2.0.1)?

I'm using Gitlab CI, but even using the Docker image locally I'm not able to pass the value to tag-format correctly.

What I'm trying to do:

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


The error log:

[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: 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: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

When it says the tagFormat option is ``, it's as if the ${version} is being replaced by empty space...

1 Answers

To solve this issue we set the tagFormat in the the release.config.js configuration file:

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