1

我使用 TeamCity 作为我的 CI 服务器。我目前正在为两个不同的分支生成 apk。现在我需要为两个不同的团队将这些 apk 上传到 hockey-app。但我不明白构建是来自默认分支还是发布分支。我试过了

#!/bin/sh    
branch=%teamcity.build.branch%   
echo $branch    
if [ $branch = "default" ]    
then   
echo "got the answer"   
else    
echo "None of the condition met"   
fi

现在我正在构建默认分支。但是第 3 行正在打印%teamcity.build.branch%而不是default 。请给我一个解决方案。

4

1 回答 1

0
branch=%teamcity.build.branch%
echo $branch
branch1=release
branch2=default
if [[ "$branch" =~ "$branch1" ]];
then
API_FOR_HOCKEY_APP
elif [[ "$branch" =~ "$branch2" ]];
then
API_FOR_HOCKEY_APP
else
echo "Build is not from any of the branches"
fi

如果 build 来自任何名称中包含字符串 release 或 default 的分支,它将分别上传到 hockeyapp。

于 2015-01-21T15:12:45.277 回答