Skip to content

Instantly share code, notes, and snippets.

@Cee
Created October 13, 2016 04:29
Show Gist options
  • Save Cee/6c4e3088736864a0189e4bd371beaec5 to your computer and use it in GitHub Desktop.
Save Cee/6c4e3088736864a0189e4bd371beaec5 to your computer and use it in GitHub Desktop.
Add Version Number
#!/bin/bash
git=$(sh /etc/profile; which git)
number_of_commits=$("$git" rev-list HEAD --count)
git_release_version=$("$git" describe --tags --always --abbrev=0)
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${git_release_version#*v}" "${PROJECT_DIR}/${INFOPLIST_FILE}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $number_of_commits" "${PROJECT_DIR}/${INFOPLIST_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment