Build your self hosted iOS CI with Gitlab

Gitlab is a wonderful tool to create your own pipeline. Combined to Fastlane, you will be able to have quickly your own CI scalable and maintainable.

Register Gitlab Runner

gitlab-runner register
Register a runner

Install Fastlane

brew install fastlane
fastlane init
fastlane init

Create Pipelines

Configure Lanes

Cocoapods Lane

Pod install lane
Test your podfile lane

Test Lane

Lint Lane

fastlane lint

Build lane

Generate Debug Lane

fastlane add_plugin firebase_app_distribution
curl -sL https://firebase.tools | bash
firebase login:ci
Generate your Firebase App Distribution Token
  • Generate App Store connect access with app_store_connect_api_key , you have to configure it with your Key ID, the issuer’s ID and the key content (find it in your P8 file)
  • Get your certificates with get_certificates , Get all certificates needed to generate and sign your Application.
  • Generate provisioning profiles with sigh , this method will get existing provisioning profile or generate them.
    It’s important to use the option force: true in order to renew provisioning profiles with newest devices. This also make your CI will not failed if someone delete your provisioning profile.
    If you generate on a Mac where XCode is not connected to any developper account, indicate the team_id and the username .
  • Set up upate_code_signing_settings in order to set your XCOde with correct Team’id, provisionning profile for each target.
  • Generate IPA with gym , this method will generate your IPA.
  • Upload it to Firebase App Distribution with firebase_app_distribution , this method will upload your previously generated IPA to Firebase App Distribution.
distribute:
stage: distribute
tags:
- mac-os
script:
- fastlane distribute
only:
refs:
- dev

Configure your Gitlab pipeline

Find your pipelines executions

History:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store