Fastlane-app automatically compiles, packs multiple versions, uploads to the App Store

Source: Internet
Author: User

Fastlane is a set of automated tools written in Ruby that can save you a lot of time with automated packaging, publishing, and more for iOS and Android.

Github:https://github.com/fastlane/fastlane

Official website: https://fastlane.tools/

Document: https://docs.fastlane.tools/

Installation

1. Install the correct Ruby version first. Confirm by using the following command in the terminal window:

Ruby-v

2. Then check that the Xcode command-line tool is installed. In the terminal window, enter the command:

xcode-Select --install

If not installed, the terminal will start to install, if reported error:command line tools is already installed, use the "software Update" to install updates. Represents already installed.

3, the above depends on the configuration can be installed through the Rubygem:

$ sudo gem install Fastlane

Wait for a while, and the Fastlane is ready for installation.

Initialization

Go to Project Catalog execution:

Fastlane Init

In the middle you need to enter the developer account and password.

After initialization, there is one more Fastlane directory in the directory, content:

Appfile

Appfile is used to store app_identifier,apple_id and team_id. For more information, it is in this format:

" com.xxx.xxx "  "[email protected]" "xxxxxxxxxx" # Team Id

You can also provide different app_identifier, apple_id, and team_id for each lane (as mentioned later), for example:

App_identifier"com.aaa.aaa"apple_id"[email protected]"team_id"aaaaaaaaaa"For_lane:inhouse DoApp_identifier"com.bbb.bbb"apple_id"[email protected]"team_id"aaaaaaaaaa"End

This is what is defined for Fastfile: inhouse sets individual information.

Fastfile

Fastfile manage the lane you created to learn more. The format of this is:

··· # Automatic Update Fastlane tool # Update_fastlane #需要的fastlane的最小版本, after each execution will check if there is a new version, if there is a new version will be appended to the end of the reminder fastlane_version"2.30.1"#默认使用平台是 iOS, which means that files can define multiple platforms Default_platform:ios Platform:ios DoBefore_all Do# env["Slack_url"] ="https://hooks.slack.com/services/ ..."Cocoapods End desc"Runs All the tests"lane:test DoScan End desc"submit a new beta version to Apple TestFlight"desc"This would also make sure"Lane:beta Do# Match (type:"AppStore") # more Information:https://Codesigning.guideGym (Scheme:"docment") # Build Your App-More options available Pilot # SH"your_script.sh"End desc"deploy a new version to the app Store"Lane:release Do# Match (type:"AppStore") # Snapshot Gym (scheme:"docment") # Build Your App-More options available deliver (force:true# FrameIt End # You can define your own lane #执行lane成功后的回调 After_all Do|lane|# slack (# message:"successfully deployed new APP Update."#) End # If the process has an exception, it will go here and terminate the error Do|lane, exception|# slack (# Message:exception.message, # Success:false#) EndEnd

We can also define a lane of our own:

 desc  "  Enterprise Edition   "  Lane:inhouse  do   gym (scheme:   " xxx   "   " enterprise   "   " ./build   "  # The directory where the packaged IPA file is stored output_name   " xxx   "  # IPA file name) end  

One lane is a task, which is a workflow consisting of one action.

With the tools that are currently supported, you can do all the steps that include automation and sustainable building, such as:

    • Scan Automation Test tool, which encapsulates the Unit test

    • Sigh download tool for developing certificates and provision file for IOS projects

    • Match Sync Team Everyone's certificate and provision file's awesome tool

    • Gym build an IPA file for IOS compiled package

    • Deliver binary code for uploading apps, applying screenshots and meta data to the app Store

    • Snapshot can automate localized screenshots of iOS apps on every device

Perform

How do you do it after you define lane? Open the terminal and switch to the project's root directory: Execute Fastlane Lane ' name. After the success will be generated in the corresponding path of the IPA file, if the error will be based on the wrong information to review the document.

Other

1. Here are some examples of official offers.

2, want to understand Fastlane command words can execute $ fastlane--help

3. To view a list of available tasks, you can execute the command $ fastlane Lanes

4, Fastlane also provides a lot of plug-ins to facilitate our use, such as Pgyer (release app to Dandelion). We can also finish the package directly to the dandelion, the specific can see the dandelion provided documentation.

If you feel that some plugins do not fit your situation, you can even customize the plugin

5, many lane words can actually call each other, this is actually particularly practical. For example:

Default_platform:ios Platform:ios DoLane:p Repare Dococoapods match End Desc'Fastlane Build'   'Fastlane Build Type:adhoc'Lane:build Do|options|# Call the prepare task above prepare CaseOptions[:type] when'Adhoc'AdhocElseAppStore end End Lane:adhoc Do  ··· End Lane:appstore Do  ··· End End

6, we can add a function in the Fastfile file to set the version number and the build number.

Default_platform:ios def prepare_version (options)    increment_version_number (        version_number:options[: Version]    )     increment_build_number (        build_number:options[:build]    ) end

You can then use this function in a lane:

 do |options|    ···    Prepare_version (options)   ... End

Then, when you execute this lane:

    $ fastlane appstore version:2.4. 0 Build:2.0

Fastlane can do a lot of things, we can go to take a good look at the document, study some advanced usage it!

Fastlane-app automatically compiles, packs multiple versions, uploads to the App Store

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.