Created
April 23, 2014 13:37
-
-
Save mbehan/11215484 to your computer and use it in GitHub Desktop.
Add as a pre compile build phase in Xcode to auto increment your build number (bundle version). Format is revHash.user.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
last_commit=$(git rev-parse --short HEAD)$([[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*") | |
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") | |
buildNum=${CFBundleVersion##*.} | |
buildNum=$((buildNum + 1)) | |
CFBundleVersion=$last_commit"."$USER"."buildNum | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "$INFOPLIST_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment