I'm trying to get a reference to my Xcode projects CFBundleVersionString or CFBundleVersion within my Jenkins Build.
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.
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.
You can read CFBundleVersionString from your Info.plist file with:
export VERSION=`defaults read ${INFO_PLIST} CFBundleVersionString`
output this to a property file:
echo VERSION=$VERSION > version.properties
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.
Similarly you can update the version inside the plist with:
defaults write ${INFO_PLIST} CFBundleVersionString ${VERSION}.${BUILD_NUMBER}
If you are using the Xcode Plugin, you have CFBundleVersion
available as $VERSION and CFBundleShortVersionString
as $SHORT_VERSION.
I found $SHORT_VERSION by searching the XCode Plugin source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With