Three minute integrated automatic packaging

Recommend an automatic packaging library Fastlane the library on the Git 1.4w+ Star, fully functional, is the existing continuous automatic update the best solution.

Is still being tested to keep track of the package and click on “next” for manual packaging? In fact, you can run a script, and then pour a cup of tea, with the test blow brag, the script will do everything for you. Life should be so sweet! Perhaps you will say: I would like to, but can not do ah. It doesn’t matter, this article will allow you to integrate the automatic packaging function within three minutes.

Automatic packaging resources

Open source files and Demo source code has been uploaded to Git https://github.com/liutongchao/Autobuild

Automatic packaging environment

Xcode must be Xcode 8 or more (because the 8 integrates the certificate configuration, greatly simplifying the configuration of the configuration file)

Integrated automatic packaging function

1 open source file Resource in the three files to the project root directory
Three minute integrated automatic packaging
Resource
Three minute integrated automatic packaging
root directory file

Autobuild.py is a Python script, is the main document to achieve automatic packaging.
AutoBuild folder is stored in three profiles plist.
Packge for automatic packaging after the output path of the IPA file, the default can be changed according to their needs.

2 use Xcode to open the autobuild.py file, modify the configuration information.
# need to change the place (according to their project information changes change) PROJECT_NAME = "Name" # project: VERSION = "1.0.0" # packaged version number will create a folder (depending on the version of the project itself has nothing to do with the version number) TAGREAT_NAME = "%s"% (PROJECT_NAME) # is corresponding to target = "CONFIGURATION Release #Release Debug environment PROFILE =" Dev "# configuration file is divided into four kinds of AdHoc Dev AppStore Ent corresponding to four kinds of configuration file OUTPUT ="./Packge/%s "% (CONFIGURATION) # package export IPA file path (please make sure that the"%s "folder and right there before) WORKSPACE ="%s.xcworkspace "% (PROJECT_NAME PROJECT ="%s.xcodeproj ")% (PROJECT_NAME) SDK = iphoneo Note: if the "s # project used pod enable the trip!!!!!! #PROJECT = None OPEN_PYUPLOAD = False # # dandelion upload is on dandelion upload True USER_KEY = "False ********************" API_KEY = "********************" #fir.im OPEN_FIR_UPLOAD = True # upload is open fir.im upload True False AppStore OPEN_APPSTORE_UPLOAD = False # # upload is open AppStore upload upload function True False USER_NAME = "USER_PASSWORD =" *************** *************** ""

PROJECT_NAME is your project name
VERSION packaged version number will create a folder (depending on the version of the project itself has nothing to do with the version number of
CONFIGURATION Release Debug)
TAGREAT_NAME target (who is the environment if the item has multiple target to specify the target, if only one target do not modify the PROFILE configuration file
) divided into four kinds of AdHoc Dev AppStore Ent corresponding to four kinds of configuration file
OUTPUT package IPA file path, for example, want to export to the table surface to replace “./Packge/” with “/Users/ username /Desktop/” (please make sure that the “%s” before the right folder and
) PROJECT = None if your project is to.Xcworkspace is running, please enable This line!
OPEN_PYUPLOAD dandelion hosting application, the default is False, if you need to upload to set to True, and fill in the dandelion account USER_KEY and API_KEY.
OPEN_FIR_UPLOAD Fir.im upload, need to configure the fir-cli, will have relevant information, how to configure fir-cli
OPEN_APPSTORE_UPLOAD automatically upload the AppStore default to False, if you need to upload to AppStore, please set to True, and fill in the developer account and password.

Note: PROJECT = None if your project is running in.Xcworkspace, please enable this trip!!!

3 make sure that your project has enabled automatic signature function, and can be run on a real machine.

Start automatic signature: TARGETS -> General

Three minute integrated automatic packaging
automatic signature configuration
4 run script

Run the script in two ways (with second ways)
. Open terminal and CD to your project root directory, and then put the autobuild.py into the terminal, and then enter, amazing things will happen.

Three minute integrated automatic packaging
drag script files into the terminal

In the resource named Python Launcher small application to the application, and then find the project root directory of the autobuild.py file.
right -> open mode -> Python Launcher

Three minute integrated automatic packaging
Python Launcher
Three minute integrated automatic packaging
right -> open mode -> Python Launcher
5 operating results
Three minute integrated automatic packaging
final packaging results

* * * * EXPORT * * * SUCCEEDED * * * packaged successfully, go to the Packge folder.
if an error has occurred, please check the configuration information for any errors.

IPA upload

Currently supports three upload methods, namely: dandelion, Fir.im, AppStore

1 dandelion upload

Need to apply for an account to the dandelion, get two Key, USER_KEY and API_KEY
II open the upload switch, and fill in the above two key.

OPEN_PYUPLOAD = True # is on dandelion upload True USER_KEY = "False API_KEY =" government government ""
2 Fir.im upload

Need to apply for a Fir.im account, get API Token
configuration of the local fir-cli environment

Reference configuration information: https://github.com/FIRHQ/fir-cli please be sure to configure the local fir-cli environment, or can not upload successfully!!

Turn on the switch

OPEN_FIR_UPLOAD = True # fir.im True False is on the upload function
3 AppStore upload

Open the switch, fill in the developer account and password.

OPEN_APPSTORE_UPLOAD = True # is open AppStore upload upload function True False USER_NAME = USER_PASSWORD = "" government "government"

Integration problem Wizard

  1. Please check if the configuration is incorrect.
    in particular the following line, if used Pod please enable this line PROJECT = None
  2. Be sure to have Xcode own tools Command Line Tools, if not, please perform the following command installation. Xcode-select –install
  3. Make sure that Xcode 8 is in the application, rather than installing Xcode 8 elsewhere.
  4. Such as the use of AppStore upload function, make sure to manually upload AppStore does not appear to be wrong.
    if the upload success, but in the iTunes Connect shows that the package is invalid, is generally a privacy issue, the need to add permissions in the info.plist. (camera, microphone, photo, etc.)
  5. If you fail to upload a dandelion, a curl: (26) couldn’t open file error occurs, replace the path “~/Desktop” for “/Users/ username /Desktop/” ~/Desktop”.

The principle of automatic packing

In fact, there are two ways to automatically pack xcodebuild+xcrun and xcodebuild, but the xcodebuild+xcrun is relatively early way, here do not introduce too much, so as not to mislead children’s shoes.
if you want to know the children’s shoes to see the reference material behind the article.

The script uses several commands from xcodebuild. Xcodebuild command from Xcode own tools Command Line Tools if you can not install the command.

Xcode-select --install

Use the xcodebuild command

'xcodebuild archive%s -scheme -sdk -configuration ONLY_ACTIVE_ARCH=NO -archivePath./build/%s.xcarchive'% (project, scheme, SDK, CONFIGURATION, APPNAME)%s%s (%s, -project)

This is packaged project command, packaged project and export.Xcarchive file to the corresponding path.

'xcodebuild archive%s -scheme -sdk -configuration ONLY_ACTIVE_ARCH=NO -archivePath./build/%s.xcarchive'% (workspace, scheme, SDK, CONFIGURATION, APPNAME)%s%s (%s, -workspace)

This is the command to pack workspace.

'xcodebuild -exportArchive -archivePath./build/%s.xcarchive -exportPath%s/%s/%s_%s_%s -exportOptionsPlist./AutoBuild/plist/%s.plist'(APPNAME, output, VERSION%, APPNAME, VERSION, CONFIGURATION, PROFILE)

The last command is to export the.Xcarchive file to the IPA file.
the core content of these commands.

Automatic packing function

Currently do their own automatic packaging can also export IPA files, in fact, the ultimate form of automatic packaging should be

  1. Package IPA file and then automatically publish to the beta or automatic verification and upload to AppStore. (now realized)
  2. Notify the relevant testing personnel after the completion of the release.

Currently bloggers are trying to study…
for the present, many operations may be required, not easy to tell in this article.

Reference information in this article

Http://www.jianshu.com/p/bd4c22952e01 http://www.jianshu.com/p/1229476fbce4

These two articles are of great help to me, there are a lot of places to explain more detailed than the article, but the ultimate goal of this article is to provide an automated packaging process.

There are good suggestions welcome to discuss with me – LC.West