Skip to content

Instantly share code, notes, and snippets.

@sonsongithub
Created August 14, 2012 05:15
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 sonsongithub/3346502 to your computer and use it in GitHub Desktop.
Save sonsongithub/3346502 to your computer and use it in GitHub Desktop.
Automatically update build number and github revision of Info.plist.
# update github revision
hash=$(git rev-parse HEAD)
/usr/libexec/PlistBuddy -c "Set :CFBundleGithubRevision $hash" "$INFOPLIST_FILE"
shorthash=$(git rev-parse --short HEAD)
/usr/libexec/PlistBuddy -c "Set :CFBundleGithubShortRevision $shorthash" "$INFOPLIST_FILE"
# update build number
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment