Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan
Forked from elmodos/revision.sh
Last active February 19, 2016 02: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 bumaociyuan/3c49f9c6b9a5850ed7fa to your computer and use it in GitHub Desktop.
Save bumaociyuan/3c49f9c6b9a5850ed7fa to your computer and use it in GitHub Desktop.
Xcode build number Git revision number
# get GIT revision number
buildNumber=`git rev-list --count HEAD`
# write build number
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${buildNumber}" "${INFOPLIST_FILE}"
# if [ "$CONFIGURATION" == "Release" ]; then
# # version number like this V0.20160109.004
# # read current version number
# versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
# # split version number by delimiter
# IFS='.' read -a array <<< "$versionNumber"
# n0=${array[0]}
# n1=${array[1]}
# n2=${array[2]}
# archiveNumer=$((n2+1))
# # write version number
# /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $n0.$n1.$archiveNumer" "${INFOPLIST_FILE}"
# fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment