我有一个 Bamboo 服务器,目前正在设置它来测试我在项目上的构建。 我想开始使用 NPM 版本或 grunt bump 对我的项目进行版本控制。
这是我当前的 Bamboo 设置,
- Bamboo 检测 repo 更改
- 运行所有测试
- 如果该分支是“主”分支,则执行将我们的生产代码移动到人工制品中的后期工作(我们只需压缩适当的文件并将它们放入其中)。
如果分支是“master”,我希望能够在第 2 步和第 3 步之间增加版本。
我正在努力想出一个好的解决方案。
我想知道只做 npm version 或 npm bump 这样的事情是否足够?看来我希望他们将其提交回 git 存储库?
寻找一些可能的建议
最佳答案
首先检测你在 master 分支上。如果是这样,请执行 npm version
更新。您还需要告诉 git 推送到远程存储库而不是缓存在 Bamboo 服务器上的存储库。例如,在构建计划的脚本任务中:
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
关于node.js - 在成功构建时增加 NPM/Grunt 版本 -- Bamboo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36701398/