Skip to content

Instantly share code, notes, and snippets.

@Bengejd
Created November 5, 2018 17:16
Show Gist options
  • Save Bengejd/3ba2ff653d2be37646a29ac21e38e4e6 to your computer and use it in GitHub Desktop.
Save Bengejd/3ba2ff653d2be37646a29ac21e38e4e6 to your computer and use it in GitHub Desktop.
# Credits : Jason Horwitz, https://github.com/sekati
# Aashish Tamsya, aashish.tamsya@gmail.com
#
#
# BuildVersion.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment