Add a script to incrementing the project build number in a yyyymmddnnn format where the nnn is an auto incrementing number (i.e. 20210103001)

This commit is contained in:
Chad Sykes 2021-01-03 14:59:47 -07:00 committed by Brandon Evans
parent 808dd022ed
commit cec8fd884a
No known key found for this signature in database
GPG key ID: D58A4B8DB64F8E93
2 changed files with 22 additions and 4 deletions

View file

@ -0,0 +1,18 @@
#!/bin/sh
PROJECT_DIR=$(pwd)/Xcodes/Resources
INFOPLIST_FILE="Info.plist"
buildString=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildDate=$(echo $buildString | cut -c 1-8)
buildNumber=$(echo $buildString | cut -c 9-11)
today=$(date +'%Y%m%d')
if [[ $buildDate = $today ]]
then
buildNumber=$(($buildNumber + 1))
else
buildNumber=1
fi
buildString=$(printf '%s%03u' $today $buildNumber)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildString" "${PROJECT_DIR}/${INFOPLIST_FILE}"

View file

@ -19,7 +19,9 @@
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>20210103001</string>
<key>CODE_SIGNING_SUBJECT_ORGANIZATIONAL_UNIT</key>
<string>$(CODE_SIGNING_SUBJECT_ORGANIZATIONAL_UNIT)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
@ -33,9 +35,7 @@
<key>SMPrivilegedExecutables</key>
<dict>
<key>com.robotsandpencils.XcodesApp.Helper</key>
<string>identifier &quot;com.robotsandpencils.XcodesApp.Helper&quot; and info [CFBundleShortVersionString] &gt;= &quot;1.0.0&quot; and anchor apple generic and certificate leaf[subject.OU] = &quot;$(CODE_SIGNING_SUBJECT_ORGANIZATIONAL_UNIT)&quot;</string>
<string>identifier "com.robotsandpencils.XcodesApp.Helper" and info [CFBundleShortVersionString] &gt;= "1.0.0" and anchor apple generic and certificate leaf[subject.OU] = "$(CODE_SIGNING_SUBJECT_ORGANIZATIONAL_UNIT)"</string>
</dict>
<key>CODE_SIGNING_SUBJECT_ORGANIZATIONAL_UNIT</key>
<string>$(CODE_SIGNING_SUBJECT_ORGANIZATIONAL_UNIT)</string>
</dict>
</plist>