如何在语义发布中获取分支名称?
How can I get branch name in semantic-release?
我正在尝试使用包含分支名称的标签格式创建语义发布。 .releaserc
文件看起来像这样:
{
"name": "Inder Semantic Release",
"version": "2.1.0",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator"
],
"tagFormat": "${want_branch_name_here}-${version}",
"branches": ['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}, {name: 'gpu', prerelease: true}, {name: 'non-root'}]
}
我想自动获取标签格式的分支名称(即用具有分支名称值的所需变量替换 ${want_branch_name_here}
),有没有办法实现?
尝试在执行命令时给出标签 semantic-release
而不是在 releaserc
中定义 tagFormat
npx semantic-release -t v${version}-$(git rev-parse --abbrev-ref HEAD)
给你一个类似 v1.0.2-master 的版本
我正在尝试使用包含分支名称的标签格式创建语义发布。 .releaserc
文件看起来像这样:
{
"name": "Inder Semantic Release",
"version": "2.1.0",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator"
],
"tagFormat": "${want_branch_name_here}-${version}",
"branches": ['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}, {name: 'gpu', prerelease: true}, {name: 'non-root'}]
}
我想自动获取标签格式的分支名称(即用具有分支名称值的所需变量替换 ${want_branch_name_here}
),有没有办法实现?
尝试在执行命令时给出标签 semantic-release
而不是在 releaserc
npx semantic-release -t v${version}-$(git rev-parse --abbrev-ref HEAD)
给你一个类似 v1.0.2-master 的版本