Automating iOS Deployment: A Step-by-Step Guide for Bitrise and App Store Connect

In this blog we explain how to use Bitrise to push iOS builds to the App Store automatically (auto-deploy). First we look at how to get the API key from the Apple App Store and how to connect it to Bitrise. Then we show how to connect your Apple Service to your app's team in Bitrise. In the final step, we add 'auto provision' to your workflow in Bitrise.

Introduction

To set up automatic distribution (auto-deployment) in Bitrise, every build has to be signed correctly with the right provisioning profile. In this guide we explain the steps needed to connect Bitrise to your App Store Connect account, so every build is uploaded automatically. That way, profiles no longer have to be generated and uploaded by hand.

The first two steps of this guide take place in App Store Connect and require the Account Holder or Admin role. If you do not have one of these roles, someone else has to carry out these steps. You can send them this guide and ask them to complete steps 1 and 2. At the end of step 2, certain information needs to be collected. These steps describe clearly what is needed to set up the configuration in Bitrise later. For that, you need the following:

  • API key file (this is a .p8 file)
  • Issuer ID
  • Key ID

If someone else carries out steps 1 and 2, make sure they send you these three items.

1. Request access to the App Store Connect API

First, we need to request access to the App Store Connect API. This can be done by a user with the Account Holder role. If you have this role, you can request access with the following steps:

  1. Go to App Store Connect and log in.
  2. Select Users and Access.
  3. Next to the title, select the Keys tab.
  4. Click the Request Access button.

‍

Auto Deployment iOS
  • You will receive an email once the request has been approved. You can only continue after approval. The email looks roughly like this:
iOS auto provisioning in bitrise

2. Generate an API key in App Store Connect

Once access to the App Store Connect API has been approved, we need to generate an API key. Only a user with the Admin role can do this. If you have this role, follow these steps:

  1. Go to App Store Connect and log in.
  2. Select Users and Access.
  3. Next to the title, select the Keys tab.
  4. Click the Generate API Key button.

‍

iOS api key in app store
  • Name the key Bitrise, select the Admin role under Access and click Generate.
  • Once the API key has been generated, select Download API Key and save the .p8 file somewhere safe. You will need this file in Bitrise later.
ios deploiment bitrise
  • Above the generated key you will see the Issuer ID. Click the Copy button next to it to copy the value. You will need to enter this value in Bitrise later.
  • Next to the Key ID, click the Copy Key ID button to copy the value. You will also need to enter this value in Bitrise later.

3. Connect an Apple Service account in Bitrise

Now that the key has been generated and downloaded, we can use it in Bitrise to connect our Apple account to our Bitrise account. Take the following steps:

  1. Go to Bitrise and log in.
  2. Select View Dashboard.
  3. Click your profile in the top right corner to open the dropdown menu and select Account Settings.

‍

bitrise and iOS deploiment
  • Select Apple Service Connection in the menu on the left (under CONNECTED ACCOUNTS).
apple service connection
    1. Click the Add connection button.
    2. Enter a name in the pop-up (we recommend using the name of your Apple Developer organisation here).
    3. Under Issuer ID, paste the issuer ID you copied from App Store Connect.
    4. Under Key ID, paste the key ID you copied from App Store Connect.
    5. Finally, select the Upload a Private Key (.p8) button and find the file you downloaded earlier.
    6. When everything is set, click the Connect button to save your connection.
apple api key authentication

4. Add the Apple Service connection to your app's team in Bitrise

Once the Apple Service Connection has been created, it still needs to be added to your app's team. You have to do this for each app separately:

  1. Open the app you want to add the connection to (via the dashboard or the Search for app... search bar in the top left corner).
  2. Once you have opened the app, select the Team tab.
iOS deployment to your app's team in bitrise
  • Scroll all the way down to Apple Service connection and select Connection not set under API key authentication (recommended). A dropdown menu with all your connections now appears.
  • Select the connection you created in the previous step.
apple service connection iOS and Bitrise
  • That's it! The changes have been saved automatically.

5. Add iOS Auto Provision to your workflow in Bitrise

Now that the Apple Service connection is set up and linked to our team, we can use it to provision our apps automatically (auto provision) during our workflow:

  1. Open the right app.
  2. Select the Workflow tab to open the workflow editor.
iOS auto provision
  • In the editor, click the + button anywhere in your flow to add a new step. Make sure you add this step above any step that builds your app (for example above Export Archive & Export for iOS).
ios deploiment
  • The step picker opens. Type iOS Auto Provision in the search bar to filter the results and select iOS Auto Provision with App Store Connect API (do not choose the Apple ID option).
  • In the editor of the step you just created, we only need to change one thing. Scroll down until you see Distribution type (Required). The text field probably says development. We need to change this. Click the Insert variable button on the right of this section.
distribution ios and bitrise
  • In the pop-up that opens, select $BITRISE_EXPORT_METHOD. You can filter the results by typing in the search bar. Selecting this makes sure the export method is always taken from the environment variables, so you can change it without having to edit the workflow itself.
  • Remove any other profiling steps from your workflow. You probably have a step called Certificate and profile installer. Click this step to open the editor and click the bin icon to remove it.
certificate and profile installer
  • Last but not least: make sure you save the changes. Do this by clicking the button in the top right corner or use the shortcut CMD + S (on a Mac).
bitrise yml

Job Burg

August 25, 2021

Kom meer te weten

Veelgestelde vragen

What is the advantage of iOS auto provisioning via Bitrise for an app team?

You automate certificates and provisioning profiles, making releases faster and more consistent while reducing manual overhead when onboarding new developers.

Which Apple configuration do you need for an Apple Service Account integration?

You need an App Store Connect API key with an issuer ID, key ID, and the private key. After that, you connect it in Bitrise as an Apple Service Connection.

How do you ensure security around API keys and p8 files in CI?

Use secrets management, minimal permissions, and a rotation policy. Configure logging so secrets never appear in output and restrict access per team.

How do you approach the App Store review process with automated deployments?

Use release branches, build numbers, changelogs and a review checklist. Combine automated builds with a manual approval gate before submission.

What maintenance agreements should accompany a CI/CD pipeline?

You build scalability and complexity for an unproven product. First product-market fit, then hardening, deeper security, and hosting choices.

Gerelateerde blogs