yarn add release-it @release-it/keep-a-changelog --dev
# 打开配置文件 vim ~/.zshrc # 配置环境变量,保存退出 export KFZ_GITLAB_TOKEN="上面获取到的Token" # 生效之 source ~/.zshrc # 验证 echo $GITLAB_TOKEN
module.exports = { git: { changelog: 'git log --pretty=format:"* %s (%h)"', commit: true, requireCleanWorkingDir: false, // 如果本地有文件变更而不需要提交则设为false requireCommits: false, commitMessage: 'Release v${version}', tag: true, tagName: 'v${version}', tagAnnotation: 'v${version}', push: true, requireUpstream: true, requireBranch: 'master' }, npm: { publish: false }, gitlab: { release: true, releaseName: 'v${version}', tokenRef: 'KFZ_GITLAB_TOKEN', assets: [] }, plugins: { '@release-it/keep-a-changelog': { 'filename': 'CHANGELOG.md' } } };
"scripts": { "release": "release-it" }
yarn release
# 跳过git只npm publish release-it --no-git # 跳过单个步骤 release-it --no-git.tag
# 发布alpha $ release-it major --preRelease=alpha v1.0.0-alpha.0 # 发布beta $ release-it major --preRelease=beta v1.0.0-beta.0 # 发布rc $ release-it major --preRelease=rc v1.0.0-rc.0 # 继续上一版本迭代 release-it --preRelease # 发布正式版本 release-it major