Skip to content

Instantly share code, notes, and snippets.

@hishma
Last active April 13, 2023 15:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hishma/956f42274b96cda6af10b40d6594dcdb to your computer and use it in GitHub Desktop.
Save hishma/956f42274b96cda6af10b40d6594dcdb to your computer and use it in GitHub Desktop.
Shell script to update the build number (CFBundleVersion) of the info.plist in the build folder.
# Shamelessly ripped of from https://blog.curtisherbert.com/automated-xcode-build-numbers-early-2019-edition/
#
git=`sh /etc/profile; which git`
bundleVersion=`"$git" rev-list --all | wc -l | tr -d '[:space:]'`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bundleVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "☛ BUILD NUMBER: ${bundleVersion}"
@hishma
Copy link
Author

hishma commented Apr 2, 2019

My version trims the whitespace from the derived bundleVersion, and also outputs the build number in the build report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment