Deploying a React Native App with Fastlane - Part 1a

Auto-Increment build numbers #

This is a part of a series of posts about deploying a React Native application with Fastlane.

Since the whole Fastlane and React Native ecosystem is constantly evolving, I’ll try to keep this post up to date to reflect the latest changes. Last Update: 2016/03/30

Introduction #

We’ll use the setup from part 1. If you haven’t read it yet or haven’t set up a Fastlane project, please do so now.

Using the approach above still leaves you incrementing the build or version number manually in Xcode each time you want to deploy your application. This can be done by Fastlane, too.

Setup #

Fastlane comes with a lot of actions. We’ll need increment_build_number and if you want commit_version_bump for this guide.

increment_build_number will automatically increment the build number in all required Xcode files by one.

commit_version_bump checks that only the relevant files have changed, so it won’t commit anything else by mistake, then creates a new commit.

After adding both actions to our fastlane/Fastfile, it should look like this:

fastlane_version "1.68.0"

default_platform :ios

platform :ios do

  desc "Submit a new Beta Build to Apple TestFlight"
  desc "This will also make sure the profile is up to date"
  lane :beta do
    match(type: "appstore")

    increment_build_number(
      xcodeproj: './ios/AwesomeProject.xcodeproj'
    )

    gym(
      scheme: "AwesomeProject",
      project: './ios/AwesomeProject.xcodeproj'
    )

    commit_version_bump(
      message: "Deployed new build #{lane_context[SharedValues::BUILD_NUMBER]}",
      xcodeproj: './ios/AwesomeProject.xcodeproj'
    )

    pilot

  end
end

That’s it! Just make sure you have a clean git status before deploying, else commit_version_bump will fail (as mentioned above).

 
38
Kudos
 
38
Kudos

Now read this

Chef tutorial #1: Setting up a chef server

This tutorial is part of a series of posts about server management with chef. If you don’t know chef, chef is an open-source systems integration framework built specifically for automating the cloud. There are two methods of using chef.... Continue →