Skip to content

Instantly share code, notes, and snippets.

@skeeet
Created July 14, 2015 05:55
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 skeeet/24b49944b08f3c4a08ca to your computer and use it in GitHub Desktop.
Save skeeet/24b49944b08f3c4a08ca to your computer and use it in GitHub Desktop.
Update XCode build and version, based on git info
#!/bin/sh
# autoupdate-revision.sh
#
# Evgeny Aleksandrov
REV_FILE="${PROJECT_DIR}/Supporting-files/version.xcconfig"
. $REV_FILE
PROJECT_VERSION=${H_VERSION_NUMBER}
COMMITS_COUNT=`git rev-list develop | wc -l | tr -d ' '`
filepath="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
echo "Updating ${filepath}"
echo "Current version ${PROJECT_VERSION}, build ${COMMITS_COUNT}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${COMMITS_COUNT}" "${filepath}"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${H_VERSION_NUMBER}" "${filepath}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment