Navigate your terminal to your project's directory
cd ./PATH/cicd-example
Setting up fastlane
fastlane init
Choose setup
[22:43:37]: -----------------------------
[22:43:37]: --- Welcome to fastlane ๐ ---
[22:43:37]: -----------------------------
[22:43:37]: fastlane can help you with all kinds of automation for your mobile app
[22:43:37]: We recommend automating one task first, and then gradually automating more over time
[22:43:37]: What would you like to use fastlane for?
1. ๐ธ Automate screenshots
2. ๐ฉโโ๏ธ Automate beta distribution to TestFlight
3. ๐ Automate App Store distribution
4. ๐ Manual setup - manually setup your project to automate your tasks
? 4
Config Fastfile
platform :ios do
desc "Build Test Flight"
# Deletes files archives as result
before_all do
sh(command: "rm -vfr ~/Library/Developer/Xcode/Archives/*")
clear_derived_data()
xcode_select("/Applications/Xcode.app")
end
# release build
lane :release do
match(type: "appstore",
app_identifier: "mobile.duc.***",
readonly: is_ci)
increment_build_number(xcodeproj: "cicd-example.xcodeproj")
build_app(
scheme: "MobileCiCd",
export_method: "app-store"
)
upload_to_testflight
end
# Deletes files created as result of running gym, cert, sigh or download_dsyms
after_all do |lane|
clean_build_artifacts
end
end
[โ] ๐
[14:03:49]: fastlane match supports multiple storage modes, please select the one you want to use:
1. git
2. google_cloud
3. s3
4. gitlab_secure_files
? 1
[14:03:55]: Please create a new, private git repository to store the certificates and profiles there
[14:03:55]: URL of the Git Repo: [email protected]:nmduc2511/cert-provision-cicd.git
[14:08:38]: Successfully created './fastlane/Matchfile'. You can open the file using a code editor.
[14:08:38]: You can now run `fastlane match development`, `fastlane match adhoc`, `fastlane match enterprise` and `fastlane match appstore`
Config match file
git_url("[email protected]:nmduc2511/cert-provision-cicd.git")
storage_mode("git")
type("appstore") # The default type, can be: appstore, adhoc, enterprise or development
app_identifier("mobile.duc..cicd-example") # bundle id app
username("n*****@gmail.com") # Your Apple Developer Portal username
To set up the certificates and provisioning profiles on a new machine
fastlane match appstore
You can also run match in a readonly mode to be sure it won't create any new certificates or profiles.
fastlane match appstore --readonly
Or setup in ./fastlane/Fastfile (Recommend)
lane :appstore do
match(type: "appstore", readonly: is_ci)
end