Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TJRoger/9633becb20b087281ed487587dd0ecc6 to your computer and use it in GitHub Desktop.
Save TJRoger/9633becb20b087281ed487587dd0ecc6 to your computer and use it in GitHub Desktop.
Script to automatically set the build number to the date
#!/bin/sh
# xcode-build-number-generator.sh
# @desc Automaticvally create build number every time using curent day, month and year
# @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"
#Credits
# tjroger@github for intial direction about automatic versioning
buildNumber=`date +%Y%m%d%H%M`
echo "Final Build number is $buildNumber"
## Below command write buildNumber in the property list
/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