Skip to content

Instantly share code, notes, and snippets.

@quentinhayot
Created August 7, 2015 10:24
Show Gist options
  • Save quentinhayot/ecd73b0aa18e8a63df69 to your computer and use it in GitHub Desktop.
Save quentinhayot/ecd73b0aa18e8a63df69 to your computer and use it in GitHub Desktop.
[Xcode] Increment build number on each release builld
##Build phases > Run Script
##Shell: /bin/bash
if [ "${CONFIGURATION}" = "Release" ]; then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment