Deploy your App while Sleep!

Scenario 1:

  • You have 1 week to develop a feature.
  • This feature will use all time, 1 week is too short.
  • After finish each task, you need deploy a version to QA.
  • After finish all feature, you need deploy a beta version to users.

To deploy a version to QA, you need delivery via Crashlytics .

To deploy a Beta version, you need delivery via TestFlight.

Time spent:

Crashlytics: 10 minutes archiving the project + 5 minutes uploading + 3 minutes selecting options and testers;

TestFlight: 10 minutes archiving the project + 15 minutes uploading + 5 minutes selecting options and testers;

Now, think that you need deploy 3 QA versions and 1 BETA version. This represents 84 minutes!

Now, remember that you need run your UI/Unit tests, if your tests need 5 minutes to run and you need run this 1 times per day, will represent 35 minutes.

You will spent about 2 hours just waiting!

Senario 2:

  • You need finish a feature and delivery for users that will install the app tomorrow 11 AM.
  • It’s 11 PM, you need to sleep, you are very very tired.
  • After finish, you need deploy a version to TestFlight;
  • Deploy to TestFlight takes 45 minutes.

Now think, after finish the feature, you will need wait 45 minutes looking to your display, just waiting, and you are very tired! Of course, you’ll get it asleep.

Automation: Fastlane

First, we need to automatize the arquive and delivery process. We will use Fastlane.

Fastlane turn your process more easy and fast. With only one command line you can deploy all your application.

Fastlane:

  1. Install fastlane

Install fast lane using:

# Using RubyGems
sudo gem install fastlane -NV

# Alternatively using Homebrew
brew cask install fastlane
  1. Setting up fastlane

Navigate your terminal to your project’s directory and run:

fastlane init

When you run this command, will be prompt some options, just select what you like.

  1. Looking Fastlane folder:
  1. Custom your Fastfile

Open the Fastfile and create your custom lanes. Look this example:

desc "Deploy a new version to the App Store"
  lane :release do
    # match(type: "appstore")
    # snapshot

    ENV["BUNDLE"] = "com.nam.AppDemo"
    
    cocoapods(
    clean: true,
    podfile: "Podfile"
    )
    
    changelog = File.read("Changelog.txt")

    #increment_build_number

    gym(
      export_xcargs: "-allowProvisioningUpdates",
      scheme: "AppDemo"
    )
    deliver(force: true)
end

All options can be found at documentation: https://docs.fastlane.tools/

Running fastlane:

fastlane release

That’s it, fastlane will deploy your application.

BUT we still have a problem, I can run with just one command line, but I need wait while my Mac runs it.

The next step: CLOUD!!!

Cloud: Bitrise

Now, we need run the deploy process without use my local computer…

  1. Create a free account: https://www.bitrise.io/;
  2. Link your git account;
  3. Click in button Add New App;
  4. Select your repository;
  5. Choose the branch that contains the fastlane setup;
  6. Select fastlane as build type;
  7. DONE!

Your first build will fail because the code sign is not setup yet.

Let’s setup code sign:

  1. Open your app on Bitrise;
  2. Click in WorkFlow tab;
  3. Go to tap Code Signing
  4. Follow the steps How to setup Code Sign
  5. DONE!

If you use fastlane match, you don’t need setup the code sign.

Additionally you can Add workflows (you will need one workflow per lane).

You can setup Environment Variables, Secrets and more.

Triggers

The magic starts when your git push start your deploy process!!!

Just setup the triggers:

Tests

You can run your tests automatically when you push your code!

Now your beta deploy, qa deploy and tests will run automatically, and you win more than 2 hours per week.

Deixe uma resposta

O seu endereço de email não será publicado. Campos obrigatórios marcados com *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑