The old TestFlight will shut down in February, so it's time to switch to a new Beta Testing service.
While there are some great alternatives to the new TestFlight (like Crashlytics Beta and HockeyApp) you might decide to use the official solution for various reasons, however unfortunately there is no public API to implement into your Continuous Integration system any more.
Introducing deliver testflight, an unofficial command line tool to upload your builds to the new Apple TestFlight (now part of iTunes Connect).
All you have to do is install deliver and add the following to your build steps:
deliver will fetch all information it needs (e.g. bundle identifier, build number, App ID, IPA file) and will ask you for missing information. You can pass additional parameters too, checkout the project page of deliver.
If you want a more advanced setup, including a fully working Continuous Deployment solution, which takes screenshots, updates provisioning profiles and creates your push certificate for you, checkout fastlane.