Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save forbze/0212f00ec31f8a8d9b15 to your computer and use it in GitHub Desktop.
Save forbze/0212f00ec31f8a8d9b15 to your computer and use it in GitHub Desktop.
git=$(sh /etc/profile; which git)
git_release_version=$("$git" describe --tags --always --abbrev=0)
number_of_commits=$("$git" rev-list master | wc -l | tr -d ' ')
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"
watch_plist="$TARGET_BUILD_DIR/Acara WatchKit App.app/Info.plist"
watch_appex_plist="$TARGET_BUILD_DIR/Acara WatchKit Extension.appex/Info.plist"
for plist in "$target_plist" "$dsym_plist" "$watch_appex_plist" "$watch_plist"; do
if [ -f "$plist" ]; then
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $number_of_commits" "$plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${git_release_version#*v}" "$plist"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment