For this step - is there a way to get the value which was set in the current info.plist in the git repo? Basically we want to use the version number set manually by us in the project. But want to avoid changing it everytime on bitrise as well. So would be handy if after a git clone, we could get an environment variable that exposes the version number in the project.
There’s a community contributed step (not maintained by us) which can do exactly this: Xcode Project Info. It exports both the Version and the Build numbers from the Info.plist
After this you can use these environment variables (XPI_VERSION and XPI_BUILD) in any other step.
Alternatively you can use a Script step and PlistBuddy to expose these infos, something like:
#!/bin/bash
set -ex
# get the values
INFO_PLIST_PATH=./path/to/Info.plist
version=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFO_PLIST_PATH}")
build=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFO_PLIST_PATH}")
# expose the env vars for subsequent steps
envman add --key XPI_VERSION --value "${version}"
envman add --key XPI_BUILD --value "${build}"
Thanks Viktor. In the Set Xcode Project Build Number Set (image attached) if we add an offset to the Bitrise Build Number, does that change the $BITRISE_BUILD_NUMBER for future use? Basically our last step is to add a git tag but we want the tag to include the correct build number. Ofcourse with the offset in the previous step, it may not be accurate.
For now, I have added the step Xcode Project Info again before the git_tag step so it gets the updated value.
Unfortunately no, you can’t change the $BITRISE_BUILD_NUMBER for subsequent builds, it’s generated by bitrise.io every time when a new build is started.
If you use these steps (the Set Xcode Build Number and Xcode Projec Info steps) it will work, but it won’t be in sync with the build number on bitrise.io (as that’s a read only value, generated right when the build starts). During the build the number will be in sync, as the Xcode Project Info step reads the value from Info.plist, and the Set Xcode Build Number step writes the value into Info.plist
In general the best is to not to use the offset, as that way you can have a “perfect sync” between steps and the bitrise.io web UI.
We have removed the offset as per your suggestion. However, if someone wants to get the updated value, a hack would be the following:
Add the step Xcode Project Info again before the git tag step so it gets the updated value from info.plist again. Then use $XPI_BUILD for the latest value.