Skip to content

Instantly share code, notes, and snippets.

@qubblr
Last active January 30, 2016 12:50
Show Gist options
  • Save qubblr/aefa1b2cf2a4197ad699 to your computer and use it in GitHub Desktop.
Save qubblr/aefa1b2cf2a4197ad699 to your computer and use it in GitHub Desktop.
# xcode-build-bump.sh 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 starti…
BUILD_NUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
VERSION_NUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
BUILD_NUM=$(($BUILD_NUM + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILD_NUM" "${PROJECT_DIR}/${INFOPLIST_FILE}"
cd "${SRCROOT}";/usr/bin/git add "${PROJECT_DIR}/${INFOPLIST_FILE}"
cd "${SRCROOT}";/usr/bin/git commit -m "Bump build number to ${BUILD_NUM}"
cd "${SRCROOT}";/usr/bin/git tag -f -a "v${VERSION_NUM}b${BUILD_NUM}" -m "Version ${VERSION_NUM}, Build ${BUILD_NUM}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment