我有一个Bamboo服务器,它目前正在设置中,用于在我的项目上测试我的构建。我想开始使用NPM版本或grunt bump对我的项目进行版本控制。
这是我目前的Bamboo设置,
- Bamboo检测到回购变化
- 运行所有测试
- 如果分支是"主"分支,那么就把我们的生产代码移动到artifactory中(我们只需压缩适当的文件并将它们放入其中)
如果分支是"master",我希望能够在步骤2和3之间增加版本。
我正试图想出一个好的解决方案。
我想知道像做npm版本或npm bump这样的事情是否足够?我似乎想让他们把这笔钱交回吉特回购?
寻找一些可能的建议
首先检测到您在主分支上。如果是,请执行npm version
更新。您还需要告诉git推送到远程存储库,而不是缓存在Bamboo服务器上的repo。例如,在构建计划的脚本任务中:
npm install
npm run build
if [[ "${bamboo.planRepository.branchName}" == "master" ]]; then
# configure git to use the remote repo
git remote set-url origin ${bamboo.planRepository.1.repositoryUrl}
rm .git/objects/info/alternates
git fetch
# update the local version
# this will increment the last version number, commit and tag the commit
npm version patch
# create your artifact
npm pack
# push the version update
git push
git push --tags
fi