Prepare iOS App for Azure Pipelines 2

Dmitriy Toropkin
Mac O’Clock
Published in
3 min readMay 26, 2020
Photo by Lee Campbell on Unsplash

In the previous part I said that I will release the second part more advanced. Today I want to talk about building a project and sending it to AppStore. Let’s start!

What should we do?

  1. Install Provision Profile
  2. Install Apple Certificate to our Azure Pool
  3. [Optional] Install Git submodules (its really nice feature)
  4. [Optional] Install CocoaPods
  5. Archive project
  6. Release (send to TestFlight)
  7. [Optional] Fetch result (success or with error)

Ok, the task is clear.

P.S. you can read about how to get .mobileprovision and .p12 here

Install Provision Profile

Add mobile provision profile to secure files on pipelines library

Get your provision profile in .mobileprovision extension. Upload it to your Secure Files in Library.

In your azure-pipelines.yml add next lines

Your .mobileprovision was added.

Install Apple Certificate

Add your Certificate (.p12) to your Secure Files (like with .mobileprovision).

Add next lines to azure-pipelines.yml (you can really copy it and replace name and password only):

Your cert was installed.

Install Git submodules

You can install your git submodules with a script:

Its check your git submodules versions which your project used

Install CocoaPods

You can install Cocoapods which 2 way:

  1. Install with a script like git submodules;
  2. With special Azure task. I prefer the second way. Add to your config file next lines:

Archive project

I show code:

xcWorkspacePath: ‘’ — Path to your workspace. If .workspace in root — just set *WORKSPACENAME*.workspace

signingOption: ‘manual’ — manual enter cause you set install cert and .p12

signingIdentity: ‘$(APPLE_CERTIFICATE_SIGNING_IDENTITY)’ — Just copy. It get your cert from installed

provisioningProfileUuid: ‘$(APPLE_PROV_PROFILE_UUID)’ — Just copy. It get your cert from installed

Release (send to TestFlight)

This task is already more difficult.

Why? You need to set your password, email, app-specific password and fastlane session if your use 2-step auth.

  1. Create a variable group in Library. You can set any name.
  2. Create property with your name for Apple Developer, your password, specific app key, FastLaneSession (if you used 2-Step auth).
  3. Import your Variable Group to Config with (insert it in begin of files aftet pool set):

P.S. To get FastlaneSession: you need to install fastlane and run a command in a terminal in the project root directory:

fastlane spaceauth -u user@email.com

Now it remains to configure Azure. Insert the next lines:

This get your archive and send it to TestFlight.

Fetch result (success or with error)

I use Telegram bot for error notifications. However, I will show the principle, and you can choose the method of notifications yourself.

You can add in the end this task with a condition. This is really easy.

I hope thanks to this article you have an understanding of how to build your application using Azure Pipelines. This is a really powerful tool, and I told only a small part of what you can do.

Don’t stop learning!

--

--