Skip to content

Instantly share code, notes, and snippets.

@kimar
Created December 6, 2017 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimar/673e6f7f81f96c01db88bbb04025bfb9 to your computer and use it in GitHub Desktop.
Save kimar/673e6f7f81f96c01db88bbb04025bfb9 to your computer and use it in GitHub Desktop.
Use this as a Run-Script-Phase in Xcode to automatically bump the Build Number in your Info.plst
if [ $CONFIGURATION == Release ] || [ $CONFIGURATION == TestFlight ]; then
echo "Bumping build number..."
plist=${PROJECT_DIR}/${INFOPLIST_FILE}
# increment the build number (ie 115 to 116)
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
buildnum=$(expr $buildnum + 1)
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $buildnum" "${plist}"
echo "Bumped build number to $buildnum"
else
echo $CONFIGURATION " build - Not bumping build number."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment