Fastlane

Install
Open terminal and put on the command:
sudo gem install fastlane -NV
Init
Open project folder in terminal and execute the command:
fastlane init
Fastfile – data about your account.
AppFile – file for script code.
Credentials management
- match - already for certs + provision (fastlane recommended, but i not recommended, details later)
- cert – only for certs
- sigh – only for provision profiles
Match
Init
fastlane match init
Create
fastlane match appstore
fastlane match development


fastlane match method
Cert
fastlane run cert method
Sigh
fastlane run sigh method


Scripts example

- update cocoapods
- load the cert and provision profiles, install/create them if need
- increment of build number by increment the last build number from
testflight - build the project and make archive (all of subscription will be
automatic) - generated archive will be upload to testflight
- open for internal testers

fastlane run testflight_beta

Jenkins
CI(Jenkins)
Install
brew install jenkins-lts
Start
brew services start jenkins-lts


Source Code Management
Then enter “Branch specifier” which will be triggered for new build (default value is a master).



Build triggers
Build environment
On this section we need pick two set up
1.
Use secret text (s) or file (s):
Add variables by this rule: “Add”->”Secret text” put name of var in field “Variable” choose “specific credential” and press “Add” (before check that your credentials not exist otherwise pick from list). If you pressed the “Add” in open window pick “Kind”->”Secret text” and then enter “Secret”- your value of var, “ID”- name for pick list of this var (free name). Enter the next variables:
- FASTLANE_SESSION
Open project folder on your mac and enter command:
fastlane spaceauth -u appaccount@email.com
After execute a command, terminal ask you to copy generated cookie (as string) in your clipboard, copy string and put in as value for variable in Jenkins.
If you have enabled 2FA authentication you should set still a two variables.
- FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD
Go to https://appleid.apple.com/account/ manage and generate the password, enter the reasons and generate (after
generate keep the string because have no possibility to see it again)

After that, put on generated string as secret for variable.
- SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER
Go to https://appleid.apple.com/account/manage and copy the one of the trusted phone numbers (this field sensitive of phone mask and that’s why copy the phone such on the web page)

After that, put on phone as a secret for variable. Your section will seem something like that.

2.
Inject environment variables to the build process.
Set the “Property content” just put on this:
PATH=$PATH/usr/local/bin
Build


Ngrok Service
ngrok http port
BitBucket

- Title - name of your webhook (no mater).
- URL - go to desktop of jenkins machine, and search ngrok terminal window


That’s all








