Skip to content

Instantly share code, notes, and snippets.

@andrewgarn
Created April 17, 2012 13:58
Show Gist options
  • Save andrewgarn/2406138 to your computer and use it in GitHub Desktop.
Save andrewgarn/2406138 to your computer and use it in GitHub Desktop.
Xcode 4 Build Version Scripts
# Run script to increase CFBundleVersion by 1 each time a build is archived under release or adhoc
#!/bin/sh
if [ "$CONFIGURATION" == Adhoc || "$CONFIGURATION" == Release ]; then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
fi
# Run script to set CFBundleVersion to local latest git commit hash
#!/bin/sh
buildNumber=`git rev-parse --short HEAD`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment