Last week I finally had some time to improve the building and distribution workflow for an iOS app we built for a client. The whole development process was a bit messy — we started with Testflight, switched to Hockeyapp when Testflight was shut down and later moved to a self hosted Enterprise distribution, because the client wanted to test the product in-house with more testers.
While the process now is a bit easier with only three different targets (dev, mainly used on my devices, test as Enterprise distribution and, of course, the App Store build) it always was a big hassle to juggle around bundle identifiers and API endpoint URLs.
So I tried to optimize the workflow. At first I tried to be extra smart and built a small Ruby script using the
xcodeproj gem to change bundle identifiers and stuff, but I quickly discovered that I’m reinventing the wheel — most of the work can be done via build configurations and schemes directly in Xcode. This blog post finally helped me to understand everything. mindblown.gif
This at least made the error-prone manual editing not necessary anymore, but I still had to compile the app, export it, upload it to the test server via Transmit, tell my coworkers that a new build is available for testing, push everything to git, etc etc.
Fortunately I rediscovered fastlane. With fastlane the work is reduced to typing “
fastlane testbuild” and it does everything from compiling the app to sending a slack message with the download link.
Fastfile looks like this and was pretty easy to create:
platform :ios do before_all do ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." end desc "Upload test build" lane :testbuild do increment_build_number bundle_version = `/usr/libexec/PlistBuddy -c Print:CFBundleVersion ../Files/Info.plist`.strip version = `/usr/libexec/PlistBuddy -c Print:CFBundleShortVersionString ../Files/Info.plist`.strip filename = "Testbuild-" + version + "-" + bundle_version + ".ipa" gym( scheme: "Testbuild", configuration: "Testbuild Release", export_method: "enterprise", output_directory: "build", output_name: filename, clean: true ) sh "./upload.sh \"" + filename + ".ipa\"" slack( message: "Testbuild-" + version + "-" + bundle_version + " is now available at XYZ", channel: "#alerts", success: true ) end end
(Sadly I did not find a way to upload to a SFTP server without writing a shell script, but that wasn't a big deal either.)
In addition to the two or three small features I’m using fastlane provides a whole bunch more. Automatic generation of screenshots, uploading them, submitting to the App store, Certificate management, etc. I hope I get to use more of them in the future.
Du suchst nach mehr? Ältere Posts von 2018 bis 2013 befinden sich im Archiv , viel Spaß!