IOS Fastlane is automatically packaged and released to the App Store, which is relatively more troublesome than the packaging in our test, mainly because the access to the App Store needs to call the relevant API for permission verification;

Automatically package Beta releases to TestFlight

From packaging to uploading to TestFlight requires the following commands:

  • gym
  • app_store_connect_api_key
  • upload_to_testflight
  • Notification The command notifies us of the current operation status.

The complete configuration is as follows

# update_fastlane default_platform (iOS) platform: iOS do # production packaging lane: hs_release do | options | desc "Release>>>>>>>App starts packing..." gym( clean: true, output_directory: './fastlane/release', output_name:"XX.ipa", scheme: 'LoanManager', configuration: 'Release',########### include_bitcode: true, include_symbols: true, codesigning_identity:"iPhone Distribution: XXXXial Information Service Co.,Ltd (83XXXXXXX)", export_options: { method: 'app-store', provisioningProfiles: {"com.xx.xx" => "description file name"},}) notification(app_icon:"./fastlane/icon.png",title:"LoanManager",subtitle: "LoanManager") "Package successfully, installation package exported >>>>>>>>", message:" Preparing for release...." ) api_key = app_store_connect_api_key( key_id: "2CT XXXXX- KM", issuer_id: "69a6de84-a3e5-XXXXX-c7c11a4d1", key_filepath: "./fastlane/2CTXXXXTKM.p8", duration: 1200, # optional (maximum 1200) in_house: false # optional but may be required if using match/sigh ) upload_to_testflight( api_key: api_key, skip_waiting_for_build_processing: true, # username: "[email protected]", # app_identifier: "com.sxx.xxx", ipa: "./fastlane/release/XX.ipa", skip_submission:true ) notification(app_icon:"icon.png",title:"LoanManager",subtitle: "IPA upload success ", message: "Automatic packaging completed!" ) end endCopy the code

Description of main Parameters

  • Lane: In Fastlane, each lane is equivalent to a task. Each task is independent and can be called to each other.

  • Gym ->codesigning_identity: package certificate name in key string;

  • Gym ->clean: deletes previous operations and builds again each time.

  • Gym -> export_options sets the packaging method, and certificate related;

  • Upload_to_testflight -> API_key: upload_to_testFlight -> API_key: upload_to_testFlight -> API_key Username and app_identifier can not be set to username or app_identifier.

  • Upload_to_testflight -> ipA: destination IPA path, relative to project root path;

App_store_connect_api_key Specifies the key for accessing the App Store. You need to apply for the key on the App home page

  • app_store_connect_api_key -> key_id
  • app_store_connect_api_key -> issuer_id The generated release ID
  • app_store_connect_api_key -> key_filepathThe local path of the downloaded key_file;

APP home page to apply for key information

APP -> User and Access, select the secret key

You can view the generated result only once. Retain the required data

Record the generated key, download the secret key file and then put it in the project specified directory;

Run commands to pack

fastlane hs_release

Tell Fastlane to carry out our missionhs_release The final result is shown in the picture. Then we can upload the App in the background of App Store. Is the build upload much faster than manual packaging?

Now publishing to testFlight is complete! All in one line!