Skip to content

Instantly share code, notes, and snippets.

@gdavis
Created April 10, 2012 18:04
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 gdavis/2353296 to your computer and use it in GitHub Desktop.
Save gdavis/2353296 to your computer and use it in GitHub Desktop.
XCode Project Build Number Auto Increment Script
# Auto Increment Version Script
# This script will increment the build number by 1
# when running a configuration other than Debug and Release
# while not on intel architecture
arch=${ARCHS:0:4}
conf=${CONFIGURATION}
if [ "$conf" != "Debug" ] && [ "$conf" != "Release" ] && [ "$arch" != "i386" ]
then
buildPlist=${INFOPLIST_FILE}
buildVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $buildPlist)
buildVersion=$(($buildVersion + 1))
echo "Incrementing build version"
echo " New build number is: $buildVersion"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildVersion" $buildPlist
fi
@gdavis
Copy link
Author

gdavis commented Apr 10, 2012

Make sure to run this script before the "Copy Bundle Resources" build phase.

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