Fastlane — Simple React Native iOS Releases

React Native App Store Deployment & Zen

“COMPUTER! RELEASE THE APP!” — Outside of Hollywood, this usually doesn’t work. Today, it pretty much will. With the release setup in this article we can make App Store deployment effective by making it simple. There’s no reason you can’t show updates to clients in the same ease and speed of web. Though you can use fastlane quite easily for Android as well, for brevity, we’ll be covering the iOS App Store.

Old photo of me releasing apps to App store

Historically, as I release apps to the App Store, I relive some kind of scholastic, math-test nightmare. I instantly forget everything and take solace in the fact that it will only hurt for a bit. For too long, we’ve blamed developers for not memorizing an ever-changing, multi-day partial process that is app publishing Hell!

“Don’t complain, create.” — Tina Roth Eisenberg

We’ll be going over the specifics for releasing a React Native application on the iOS App Store or Testflight in a simple and reproducible way. “BUT WAIT!” you say, “Won’t it just CHANGE and render this blog post useless, like the multitude of other posts in the wild?” Nope! Enter the hero:

freakin use fastlane.

Consider fastlane (and included commands) as a dynamic and automated go-between. With a proper fastlane setup, you won’t just be set, you’ll be adaptable! As the process for the online store changes, the commands I type at my terminal do not. We’ll only cover the key tools to get you started.

App Release Big Picture — 3 Goals

Do the App ID security/certificates dance with Apple 💃 Secure the certs & provisioning profiles for the team 🔐 Bump versions and send them to Apple (99% of what we do after today… Seriously, I type npm run beta to release apps to clients for testing.)

It’s really that simple. Fastlane helps us with step 3, and surprise! It helps us with step 2! But WAIT! There’s more, annnnnd with step 1, too. Man, I love this tool. You can now manage your accounts, testers, and versions from the terminal!

The steps below accomplish the aforementioned goals

Step 0: Get Apple Access and fastlane

Apple Access: You’ll need access to 2 sites:

https://developer.apple.com/account/ — For certs etc.

https://itunesconnect.apple.com — For app store access

Pro Tip: It USED TO BE, you could only have 1 unique email for developer.apple.com, but that has changed. If you used to use iosdevs+theirCompany@yourCompany.com you don’t need it to be unique anymore. Both Apple and Fastlane support multiple organizations.

Install fastlane: Got Ruby? Get installing! It’s global!

$ sudo gem install fastlane --verbose

$ xcode-select --install # ensure x-code command line tools

$ gem cleanup # optional recommended

Step 1: Identifiers, and Profiles, and Certs — OH MY!

No more manual process for app setup! The entire process of creating, encrypting, and sharing with your team has been solved. One of the MANY tools you get with fastlane is called match. Using match, we have a simple terminal setup process that results in an encrypted and versioned code signing identity for your dev team.

Developer teams often share keys in non-uniform ways. Match will add sanity to this process and encrypt the credentials.

Q: How should I think of match? What does it do?

Match actually uses several other tools under the hood, but only when needed. It’s like a setup wizard more so than a command. It detects and asks you steps along the way, so I’m not going to say much more than it gets your App Store setup and your local setup coordinated.

First time running, so we create our match file with:

$ fastlane match init

This system stores your certs/profiles, and is capable of storing them in a variety of locations!

We’ll choose git in this tutorial, but it’s simple enough to store anywhere else you might like!

This asks for the git repo where we’ll be storing our certs/profiles. Follow the steps to completion. As of this writing USE A NEW PRIVATE REPO!

Make sure you set your new repo to private and supply the URL to the CLI.

Use the URL that ends with .git

Go identify your bundle id. To do so, open your project in Xcode, go to properties, and look for bundle identifier.

IF you have not created your app id on these two sites (mentioned in step 0), you can use produce to create them quickly now. If your iTunes account is a different username you can skip itunes with the -i flag.

fastlane produce -u <your user email> -a <your bundle id>

This will probably ask you to provide your 2 Factor Auth

IF YOU HAVE ANY ISSUES — Read the error message carefully. I’ve had this process denied due to “name is already taken” as well as cryptic “failed” messages which meant I needed to go sign new Apple paperwork.

Now we run the command that makes everything work. It is important to note, this is the command you would run on a new computer or new developer’s computer, too! Run through this process and enjoy. If you get stuck at any point, you can always quit and handle things manually.

$ fastlane match appstore

This will log in to your accounts, and walk you through the setup process:

For now, we will not do any of the fancy options, like using ‘deliver’ for screenshots. Respond, no, if it asks.

This will prompt you for the password to encrypt your certificates. Be sure to use something you can remember, otherwise you’ll have to start from the beginning!