This script will automatically upload your app to iTunes Connect after a successful Xcode archive action.
After doing this about a million times by hand (i.e., opening the Organizer, clicking on "Upload to App Store", waiting for teams to load, etc.), I decided I'd had enough. Now, I just go to "Product" > "Archive", sip my margherita, and kick up my feet while the world marvels at my genius, while my app gets distributed to my testers without lifting but a finger. Or...I just take a bathroom break. Either way, it's pretty awesome.
Yes, yes, I know you can do this completely via fastlane, but I'm somewhat sadistic and prefer to do my archiving completely within Xcode.
To make this work, open up the build scheme you use to submit your App Store builds, go to "Archive", and then "Post-actions". Click the "+" and "Add Run Script Action". Then, paste in the contents of post_action.sh, replacing "[email protected]" with your iTunes Connect username.
Lastly, place iTunesExportOptions.plist in your project directory. Depending on your needs (e.g., if you want to distribute enterprise builds) you may need to make some tweaks. See xcodebuild -help
for more details. By default, it assumes you just want to submit the build to the App Store / TestFlight.
gem install pilot
You may want to run pilot at least one time prior, interactively on the command line, so that your credentials are saved for future use.