Скачиваем репозиторий с кодом. Переходим в директорию кода для iOS и выполняем:
fastlane init
[✔] ? [✔] Looking for iOS and Android projects in current directory... [11:06:05]: Created new folder './fastlane'. [11:06:05]: Detected an iOS/macOS project in the current directory: 'My-iOS-app.xcworkspace' [11:06:05]: ----------------------------- [11:06:05]: --- Welcome to fastlane ? --- [11:06:05]: ----------------------------- [11:06:05]: fastlane can help you with all kinds of automation for your mobile app [11:06:05]: We recommend automating one task first, and then gradually automating more over time [11:06:05]: 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 — "Manual setup"
Указываем репозитирий для хранения сертификатов:
fastlane match init
[✔] ? [13:26:32]: Please create a new, private git repository [13:26:32]: to store the certificates and profiles there [13:26:32]: URL of the Git Repo: [email protected]:artem/certificates.git [13:26:59]: Successfully created './fastlane/Matchfile'. You can open the file using a code editor. [13:26:59]: You can now run `fastlane match development`, `fastlane match adhoc`, `fastlane match enterprise` and `fastlane match appstore` [13:26:59]: On the first run for each environment it will create the provisioning profiles and [13:26:59]: certificates for you. From then on, it will automatically import the existing profiles. [13:26:59]: For more information visit https://docs.fastlane.tools/actions/match/
Ссылку на Bitbacket я указываю по протоколу SSH, поэтому на сервере, где установлен Fastlane берем открытый SSH ключ и копируем его в настройки репозитория.
Bitbucket — Settings — Access Keys — Add key
После этого в учетной записи разработчика Apple появится сертификат с типом "iOS Distribution"
Получаем AdHoc сертификат:
fastlane match adhoc
[✔] ? [13:41:25]: Successfully loaded '/Users/admin/my-ios-app/ios/fastlane/Matchfile' ? +---------+---------------------------------------------------------+ | Detected Values from './fastlane/Matchfile' | +---------+---------------------------------------------------------+ | git_url | [email protected]:artem/certificates.git | | type | development | +---------+---------------------------------------------------------+ +-----------------------+---------------------------------------------------------+ | Summary for match 2.112.0 | +-----------------------+---------------------------------------------------------+ | type | adhoc | | git_url | [email protected]:artem/certificates.git | | git_branch | master | | storage_mode | git | | keychain_name | login.keychain | | readonly | false | | verbose | false | | force | false | | skip_confirmation | false | | shallow_clone | false | | clone_branch_directly | false | | force_for_new_devices | false | | skip_docs | false | | platform | ios | +-----------------------+---------------------------------------------------------+ [13:41:25]: Cloning remote git repo... [13:41:25]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match. [13:41:27]: ? Successfully decrypted certificates repo [13:41:27]: To not be asked about this value, you can specify it using 'username' [13:41:27]: Your Apple ID Username: [email protected] [13:42:23]: You can also run `fastlane match` in readonly mode to not require any access to the [13:42:23]: Developer Portal. This way you only share the keys and credentials [13:42:23]: $ fastlane match --readonly [13:42:23]: More information https://docs.fastlane.tools/actions/match/#access-control [13:42:23]: Verifying that the certificate and profile are still valid on the Dev Portal... ------------------------------------------------------------------------------------- Please provide your Apple Developer Program account credentials The login information you enter will be stored in your macOS Keychain You can also pass the password using the `FASTLANE_PASSWORD` environment variable See more information about it on GitHub: https://github.com/fastlane/fastlane/tree/master/credentials_manager ------------------------------------------------------------------------------------- Password (for [email protected]): *********
Вводим Apple ID и пароль и получаем AdHoc сертификат в репозитории.
Получаем AppStore сертификат:
fastlane match appstore
Вводим Apple ID и пароль и получаем AppStore сертификат в репозитории.
Для указания другой ветки в репозитории сертификатов, нужно создать файл Matchfile
Matchfile:
git_url("[email protected]:artem/certificates.git") git_branch("my-ios-ap")