Skip to content

Instantly share code, notes, and snippets.

View SergioEstevao's full-sized avatar

Sérgio Estêvão SergioEstevao

View GitHub Profile
@SergioEstevao
SergioEstevao / XCode Build and Version numbers based on GIT
Last active December 17, 2015 15:48
XCode Build and Version numbers based on GIT
# grabbing version number from the info.plist of the app
COMERCIAL_VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Info.plist`
# grabbing number of commits in the current branch to create a version number
BUILD_VERSION=`git rev-list HEAD | wc -l | tr -d ' ' | tr -d '\n'`
# grabbing the commit hash for future reference
GIT_VERSION=`git show --abbrev-commit | grep '^commit' | sed 's/commit //' | tr -d '\n'`
# export values to preprocessor file