Skip to content

Instantly share code, notes, and snippets.

@kmonaghan
Created May 29, 2012 11:39
Show Gist options
  • Save kmonaghan/2827983 to your computer and use it in GitHub Desktop.
Save kmonaghan/2827983 to your computer and use it in GitHub Desktop.
Example script to update Bundle version using number of git commits before archiving an iOS project in Xcode. See http://www.karlmonaghan.com/2012/05/30/auto-versioning-and-auto-uploading-to-testflighthockeyapp-when-archiving-in-xcode/ for more informatio
GIT=`which git`
REV=`$GIT --git-dir=${SOURCE_ROOT}/.git log --pretty=format:'' | wc -l | sed 's/\ //g'`
BASEVERNUM=`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "${SOURCE_ROOT}"/"${INFOPLIST_FILE}"`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BASEVERNUM.$REV" "${SOURCE_ROOT}"/"${INFOPLIST_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment