Created
August 22, 2015 07:10
-
-
Save lifecube/c4041ca1fa65c6e8f53e to your computer and use it in GitHub Desktop.
Revisions
-
lifecube created this gist
Aug 22, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ # xcode-build-timestamp-version.sh # @desc Auto-update the build number and build version every time the project is run using the current timestamp. # @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. Check the checkbox "Run script only when installing" buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}") buildNumber=$(date +"%Y%m%d%H%M%S") /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}" buildVersion=$(date +"%Y.%m.%d") /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $buildVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}"