Automatic mobile app releases with fastlane
Every single time I had to upload an app to the app stores, it was a pain…until I met fastlane!
At our company, there was always someone that ended up in charge of releasing new app versions to the store, and it could take that person around 1 hour to make changes, review details, release to the stores, rollout changes and review that everything went well.
Because of that faulty release cycle, I went out to search for a tool to simplify that process and to save our valuable time. I wanted to replace that person in charge of the releases with a machine so that our project manager could review the end product and be in control of the process without requiring our developers.
Get rid of the man in the middle between your developers and your release, replace it with a machine
Fastlane setup
To use fastlane, you have to configure it per platform. That means that if your application supports both android and ios, you will need to configure it twice in the same project.
In fastlane you create something called lanes, and then run them using fastlane lane_name
For example, to create a lane to deploy your application to android beta you can have something like this:
platform :android do desc "Submit a new Beta Build to Play Store" lane :beta do gradle(task: "clean assembleRelease") upload_to_play_store( apk: '../build/app/outputs/apk/release/app-release.apk', track: 'beta', ) end end
This will create a new release in the play store console and roll it out to the users who have accepted beta preview. You can, of course, release it directly to the public if that fits your flow better.
Configure production version and changelog
Normally as part of the release process, you have to update your release notes. You may want to edit the description or the screenshots. All of this can be done from the repository now.
Fastlane creates several folders and fills them with information that is retrieved from the store during the connection process. When the app has been tested and is ready for release, as part of the release process, the developers can update the files created by fastlane and those changes will reach the stores without them having to go into every console and setting them up manually. This may look like something simple, but changing a couple text lines in the web can take from 15m to 30m. This can be worse if you are not used to doing it or do it sparingly.
The developers will need to also update the build number and the version, but that happens only in code now. Instead of having this flow:
- Update the version (build and version name)
- Create the release in the repository
- Create and sign the package
- Create a release in the store
- Update the changelog
- Upload the generated package to the store
- Make it public
We can have the following steps:
- Update the version (build and version name)
- Update the changelog
- Create the release in the repository
- Run fastlane
Saving a lot of time already!
Update screenshots
Both stores (app store and play store) display some images so you can show your users how the application works and what they should expect from it.
There are several options with what you can do with this
- You could leave your image folders empty and tell fastlane that you want to manage the images directly in the store.
- You can add your images to the screenshots folder and update them as part of your release process.
- You can tell fastlane to automate screenshot capture. This can be a HUGE time saver if your app has more than 5 screens. You can take screenshots on several devices (simulators) on different languages at the same time and let fastlane setup the configuration for you.
If your application is small, it may be not worth it. But as your app starts growing and you spend more and more time taking screenshots, you can find this useful.
Get rid of the developer in charge of releases
If you work with continuous deployment and have a well-established flow for releases, you can configure fastlane on a mac machine. Why mac? Because ios forces you to. If you are working with android only then you should be able to use Linux.
The initial configuration and creation of your lanes may take some time, but once you have that working it should work with no further issues from there on.
When your release is ready you can trigger the build automatically with any mechanism you use for your traditional web apps. You will be effectively removing the man in the middle.
Final words
Fastlane allows you to do a lot of things. You don’t have to set up everything to get started. You can set up a lane and start from there, creating more as you understand how much time fastlane is saving for your team and how much more efficient it can make the process.
If you work on flutter, you can check the documentation they created to integrate with fastlane. Obviously, it is not restricted to this framework, but it is the one I am using as of lately.