[Kickstart] Release iOS App Using Fastlane and Gitlab CI (2/2)

Setup Fastfile

platform :ios do
lane :deploy do |options| # // 1
build_number: Time.new.strftime('%s%3N')
puts lane_context # // 2
# // 3
version = get_version_number
build = get_build_number
add_badge(shield: "TEST-#{version}:#{build}-orange", dark: true)

# // 4
build_app(scheme: "REPLACE_WITH_YOUR_PROJECT_SCHEME", export_xcargs: "-allowProvisioningUpdates")
# // 5
upload_to_testflight(team_id: "REPLACE_WITH_YOUR_TEAM_ID", app_identifier: "REPLACE_WITH_YOUR_APP_IDENTIFIER", skip_waiting_for_build_processing: true)
# // 6
reset_git_repo(force: true)
  1. with every build to testflight.. you will need to increment the build number and honestly i found that making it with sequencal number is a bit of a hustle with all the commits you need to do and confilicts you need to resolve .. so I took this approach of adding the current milliseconds and reset the repo on last step //6
  2. puts is ruby’s way to say (print) .. we are just printing the context to make it easy to debug if something wrong.
  3. for me that’s a nice feature if you are building an app for test only or internal usage.. you can add badge .. to enable this you need to follow instructions here. the badge will appear above the app Icon and make it easy to differentiate for your QA engineer. For production.. well you don’t need that so you can remove / comment this 3 lines anyway.
  4. here to build the app . you need to replace your scheme for sure.
  5. now here is the uploading part.. get your team ID from your apple developer dashboard and replace bundle id with yours.


source 'https://rubygems.org'ruby '2.7.1'gem 'cocoapods', '1.10.0.rc.1'
gem 'fastlane', '2.162.0'
gem "badge"
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)




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