DEV Community

Jeiman Jeya
Jeiman Jeya

Posted on

How To Automate App Releases using Fastlane and SemVer for Hybrid Applications

Placeholder image for article

NOTE: This tool/implementation is useful for when you have both iOS and Android binary applications residing within the same repository (usually a React Native application) or hybrid app development tools which produce iOS and Android apps. However, it can be customisable to your needs with a little re-configuration.

The Story

Imagine if we could automate the entire app versioning process for our mobile applications by just typing in whether you want to bump it by:

  • Major
  • Minor
  • or Patch

Imagine if you don’t have to worry about the app versioning process of knowing what is already in production and what version we need to bump it to?

Lo and behold, the App Release Management (ARM) tool. 🎉

NOTE: Semantic versioning MAJOR, MINOR, and PATCH is the de facto standard you use to version your applications. Please refer to this link to find out more about SemVer standards.

Fancy word, but what does it actually do?

It pretty much does what is mentioned above. The process is as follows:

  1. It will fetch the latest versions from TestFlight and Google Play Console respectively.
  2. It will show you a summary of what the versions are.
  3. If both Android and iOS match, the tool will select either one of them to use as the base of bumping the version.
  4. The tool will prompt you whether you would like to bump it based on major, minor, or patch
  5. Based on the input, the tool will run a SemVer operation in calculating the next iteration in the version and display the results for you.
  6. If you’re happy with the result, you may press yes to proceed.
  7. It will update the following files for you:
    1. package.json
    2. android/app/build.gradle
    3. ios/ProjectName.xcodeproj/project.pbxproj
  8. Operation completed!

It all looks fancy, but why this approach?

Well, imagine if you are a product owner or a new engineer who is new to the application code and is required to manage the App Releases. This tool will aid them in completing their task with ease, without worrying about configuring the wrong version code bump by accident.

Ok cool, how do I set it up?

  1. Please refer to the documentation README file for detailed instructions on how to set up the tool.
  2. Clone the devops-fun repository.
  3. Once completed, navigate to development > app-release-management-tool folder.
  4. Ensure that the .env file is present before proceeding any further. Refer to the README file for more information.
  5. Run fastlane command.
  6. Choose Option 1.
  7. The rest are pretty self-explanatory thereafter.

What if I want to manually bump the version via a tool?

You may run the bump-version.sh and pass in a version code as an argument: ./development/app-release-management-tool/bump-version.sh 3.2.0

What does it look like?

CLI tool

Based on the image above, the following actions occur:

  • It will do a check against your iOS TestFlight build number and Google App Version and identify if the versions match (Please refer to the README.md file on how to set up a service connection to the respective stores in order to retrieve the app details programmatically).
  • If they do, it will display your current version in the App stores and will ask you for input, whether you want to bump the major, minor, or patch.
  • Based on your input, it will use the semver.sh script to perform the necessary version bump according to the Semantic Versioning standards.
  • If they don't match up, you'll be defaulted to using the bump-version.sh which requires manual input of your SemVer for your application - ie ./bump-version.sh 2.2.0

I hope this article has proven beneficial and useful to your release management process. If you have any inquiries, please reach out to me. Happy automating your release process! Do leave a comment or recommendations on improving the tool.

Resources

References

Discussion (0)