Skip to content

Instantly share code, notes, and snippets.

@clburlison
Created February 15, 2017 21:02
Show Gist options
  • Save clburlison/da0827cbc685f0352231e11ed1af5827 to your computer and use it in GitHub Desktop.
Save clburlison/da0827cbc685f0352231e11ed1af5827 to your computer and use it in GitHub Desktop.
Update the CFBundleVersion based off of your git commits.
# based on http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode
if git rev-parse --is-inside-work-tree 2> /dev/null > /dev/null; then
echo "Setting CFBundleVersion to Git rev-list --count"
build_number=$(git rev-list HEAD --count)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $build_number" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
else
echo "Not in a Git repo, not setting CFBundleVersion"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment