参考Jenkins的Xcode版本号 [英] Reference Xcode version number from Jenkins

查看:521
本文介绍了参考Jenkins的Xcode版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的Jenkins Build中获取对我的Xcode项目CFBundleVersionString或CFBundleVersion的引用。

I'm trying to get a reference to my Xcode projects CFBundleVersionString or CFBundleVersion within my Jenkins Build.

我的目标是能够设置内置编号这种时尚$ {CFBundleVersionString}。$ {build_number}。这样,版本由项目决定,并在构建项目时添加内部版本号。

My goal is to be able to set the build numbers in this sort of fashion ${CFBundleVersionString}.${build_number}. This way the Version is dictated by the project and the build number is added on when the project is built.

这有可能吗?我知道你可以引用$ {build_number}。另外我知道我可以在构造中包含一个参数,但我希望它们都可以通过Xcode项目进行管理,因为我们的构建是由github提交触发的。

Is this possible at all? I know that you can reference ${build_number}. Also I know that I could include a parameter in the build that is dictated, but I would prefer it all be managed through the Xcode project since our builds are triggered by github commits.

推荐答案

您可以从Info.plist文件中读取CFBundleVersionString:

You can read CFBundleVersionString from your Info.plist file with:

export VERSION=`defaults read ${INFO_PLIST} CFBundleVersionString`

将此输出到属性文件:

echo VERSION=$VERSION > version.properties

并使用此文件将环境变量注入jenkins构建。
然后,您可以将此变量用于 Build Name Setter插件或者只是在构建邮件中使用它。

and use this file to inject environment variables to your jenkins build. You can then use this variable with Build Name Setter plugin or simply us it in build mails.

同样,您可以使用以下内容更新plist中的版本:

Similarly you can update the version inside the plist with:

defaults write ${INFO_PLIST} CFBundleVersionString ${VERSION}.${BUILD_NUMBER}

这篇关于参考Jenkins的Xcode版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆