Created
July 2, 2014 02:40
-
-
Save jeremygibbs/69dff746c372176215d7 to your computer and use it in GitHub Desktop.
Shell script for the build phase that auto-increments an Xcode project's build number.
This file contains 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
# Auto Increment Version Script | |
buildPlist=$INFOPLIST_FILE | |
echo $buildPlist | |
CFSVString=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$buildPlist") | |
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$buildPlist") | |
BUILD_NR=${CFBundleVersion##*.} | |
BUILD_NR=$(($BUILD_NR + 1)) | |
LEN=$(echo ${#CFSVString}) | |
if [ $LEN -eq 3 ]; then | |
CFBundleVersion=$CFSVString".0."$BUILD_NR | |
else | |
CFBundleVersion=$CFSVString"."$BUILD_NR | |
fi | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "$buildPlist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment