Last active
March 31, 2016 13:27
-
-
Save elmodos/df3838db7782f9b1c122 to your computer and use it in GitHub Desktop.
Add this script to Build Phases of your target in Xcode to automatically set build number with SVN/Git revision number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set build number only for release (Product|Archive) | |
if [ "$CONFIGURATION" == "Release" ]; then | |
# get GIT revision number | |
buildNumber=`git rev-list --count HEAD` | |
# if not git, then get SVN revision number | |
if [[ -z "$buildNumber" ]]; then | |
buildNumber=`svn info | grep "Revision" | awk '{print $2}'` | |
fi | |
# set default value if no rev number found | |
if [[ -z "$buildNumber" ]]; then buildNumber=1; fi | |
# write build number into project plit file | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${buildNumber}" "${INFOPLIST_FILE}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment