Skip to content

Instantly share code, notes, and snippets.

@Valthoron
Forked from sekati/xcode-build-bump.sh
Last active December 9, 2022 10:22
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Valthoron/5317029 to your computer and use it in GitHub Desktop.
Save Valthoron/5317029 to your computer and use it in GitHub Desktop.
Set a timestamp as the build number when an Xcode project is compiled.
# xcode-build-timestamp.sh
# @desc Set a timestamp as the build number when the project is compiled.
# @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 "Target dependencies"
buildNumber=$(date +%Y%m%d%H%M)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
@zaferbozkurt
Copy link

more readable with below code

buildNumber=$(date +%Y.%m.%d.%H.%M)
/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