Skip to content

Instantly share code, notes, and snippets.

@mwermuth
Created June 2, 2015 07:56
Show Gist options
  • Save mwermuth/3027de74d85c9349b95f to your computer and use it in GitHub Desktop.
Save mwermuth/3027de74d85c9349b95f to your computer and use it in GitHub Desktop.
Updating Xcode Build number for iOS App Target
branch=${1:-'master'}
buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count))
echo "Updating build number to $buildNumber using branch '$branch' for App Target."
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment