Skip to content

Instantly share code, notes, and snippets.

@incanus
Created October 24, 2013 19:54
Show Gist options
  • Save incanus/7143885 to your computer and use it in GitHub Desktop.
Save incanus/7143885 to your computer and use it in GitHub Desktop.
INFO=$( echo $TARGET_BUILD_DIR )/$( echo $INFOPLIST_PATH | sed -e 's/\.plist$//' )
echo $INFO
TAG=
COMMIT=
CURRENT=
CURRENT_BUILD=
GITPATH=/usr/bin:/usr/local/bin:/usr/local/git/bin
PATH=$PATH:$GITPATH; export PATH
if [ -z $( which git ) ]; then
echo "Unable to find git binary in \$GITPATH"
exit 1
fi
SHORT_VERSION=$( git describe --tags )
VERSION=$( echo $SHORT_VERSION | sed -e 's/^v//' | sed -e 's/-/./' | sed -e 's/-.*//' )
echo $VERSION
defaults write "$INFO" CFBundleShortVersionString $SHORT_VERSION
defaults write "$INFO" CFBundleVersion $VERSION
chmod 644 "$INFO.plist"
@incanus
Copy link
Author

incanus commented Oct 25, 2013

This writes to the build app (OS X) bundle with some Git info as to the build number. Could be adapted for other uses / iOS use, I'll wager.

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