Last active
August 29, 2015 14:16
-
-
Save edwardmp/86f912c98a3c96411714 to your computer and use it in GitHub Desktop.
Xcode 6 automatic build number updating based on amount of Git commits
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
buildPlist="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
PlistBuddy="/usr/libexec/PlistBuddy" | |
git=`sh /etc/profile; which git` | |
CFBundleVersion=`"$git" rev-list --all | wc -l` | |
$PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "$buildPlist" | |
#$PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "$INFOPLIST_FILE" | |
$PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "${DWARF_DSYM_FOLDER_PATH}/${WRAPPER_NAME}.dSYM/Contents/Info.plist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this as a run script, after the copy bundle resources phase. Click the checkmark next to "run script only when installing", this will make sure the build number is only incremented when the scheme is set to release or an archive export is done. It does not change your local Info.plist file (this is the commented out line), so it does not dirty your git commits.