Skip to content

Instantly share code, notes, and snippets.

@marcisme
Created September 13, 2016 04:00
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 marcisme/7a27cd6ba0f090cdc2b4586f072221d3 to your computer and use it in GitHub Desktop.
Save marcisme/7a27cd6ba0f090cdc2b4586f072221d3 to your computer and use it in GitHub Desktop.
#!/bin/sh
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"
for plist in "$target_plist" "$dsym_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
@rajan2211
Copy link

After using this script I am not able to get the version and build number programmatically. Also when I am trying to upload the build to the app store I am getting this error. "The Info.plist in the package must contain the CFBundleShortVersionString key".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment