DEV Community

Andreas Bergström
Andreas Bergström

Posted on

1

Set Xcode build numbers to incremented or timestamps

Never again should you need to archive and upload a build to just be told you forgot to change the build number in Info.plist. Automate it! Simply add a build phase to your project that either increments the build version by 1 or just use a timestamp:

Incremented number

buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
Enter fullscreen mode Exit fullscreen mode

Timestamp

buildNumber=$(date +%Y%m%d%H%M)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
Enter fullscreen mode Exit fullscreen mode

Also make sure to check "For install builds only" to only run this step when archiving.

test

Note for Appcenter! If you have your build config on Appcenter configured to increment builds numbers you might run into issues if you use a custom build step like this.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more