Created
May 1, 2012 22:23
-
-
Save PaulCapestany/2571946 to your computer and use it in GitHub Desktop.
Xcode Auto-incrementing Version and Build numbers
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
# forked from Luke Jernejcic http://mostlybinary.com/2012/04/03/how-to-auto-increment-your-ios-build-number/ | |
BUILDNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
BUILDNUM=$(($BUILDNUM + 1)) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILDNUM" "${PROJECT_DIR}/${INFOPLIST_FILE}" | |
# this splits a two-decimal version string, such as "0.45.123", allowing us to replace the latest build number at the 3rd position | |
VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
NEWVERSIONSTRING=`echo $VERSIONNUM | awk -F"." '{print $1 "." $2 ".'$BUILDNUM'" }'` | |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $NEWVERSIONSTRING" "${PROJECT_DIR}/${INFOPLIST_FILE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment