purpose
Package a small package robot small application, double click can make the project automatically package uploaded to fir. Im
Train of thought
Sh script to execute the xcodebuild command for packaging, and then upload the fir- CLI command to the fir. Im. After the test can be packaged normally, use the Mac automation tool to execute the script
process
1. Verify that Ruby exists
ruby -v
Copy the code
2. Install fir – cli
sudo gem install fir-cli
Copy the code
3. Check whether XcodeBuild is installed
xcode-select --install
Copy the code
I’m going to need a.sh script in my configuration file, and I’m going to need a.plist certificate configuration table, and I’m going to put that in my scripts folder and I’m going to download it
Then put the scripts folder into the project directory
The plist table configuration is as follows
You are advised to obtain teamID,method, and provisioningProfiles from the exportOptions. plist file generated by manual packaging
The mapping between debug_config.plist and exportOptions. plist, where method is used for internal test and development, and App Store is used for shelves
4. Sh
#! /bin/sh
# Your configuration information
target_name="xxxxxx.xcodeproj" # Valid values ****. Xcodeproj / ****. Xcworkspace (Cocoapods project)
project_name="xxxxxx" # project name
work_type="workspace" Project/workspace (Cocoapods project)
api_token="Your fir tonken." # fir token
sctipt_path=$(cd `dirname $0`; pwd)
echo sctipt_path=${sctipt_path}
work_path=${sctipt_path}/..
rm -rf ${work_path}/build
#cd .. /
#pod install --no-repo-update
#cd ${sctipt_path}
out_sub_path=`date "+%Y-%m-%d-%H-%M-%S"`
out_base_path=".. / Package file"
out_path=${work_path}/${out_base_path}/${out_sub_path}
mkdir -p ${out_path}
if [[ -s "$HOME/.rvm/scripts/rvm"]].then
source $HOME/.rvm/scripts/rvm
rvm use system
fi
xcodebuild -$work_type ${work_path}/$target_name -scheme $project_name -configuration Debug -sdk iphoneos clean
xcodebuild archive -$work_type ${work_path}/$target_name -scheme $project_name -configuration Debug -archivePath ${out_path}/$project_name.xcarchive
xcodebuild -exportArchive -archivePath ${out_path}/$project_name.xcarchive -exportPath ${out_path} -exportOptionsPlist ${sctipt_path}/debug_config.plist
echo ${out_path}/$project_name.ipa
if [[ -s "$HOME/.rvm/scripts/rvm"]].then
source ~/.rvm/scripts/rvm
rvm use default
fi
fir p ${out_path}/$project_name.ipa -T $api_token-c Releases the debug versionexit 0
Copy the code
Mkdir -p ${out_path} is an example of how to configure a path
xcodebuild -$work_type ${work_path}/$target_name -scheme $project_name -configuration Debug -sdk iphoneos clean
xcodebuild archive -$work_type ${work_path}/$target_name -scheme $project_name -configuration Debug -archivePath ${out_path}/$project_name.xcarchive
xcodebuild -exportArchive -archivePath ${out_path}/$project_name.xcarchive -exportPath ${out_path} -exportOptionsPlist ${sctipt_path}/dev_config.plist
Copy the code
Xcodebuild command the clean, archive, exportArchive isn’t very familiar feeling, is our regular removal, such as packaging, export operation, by means of command execution
fir p ${out_path}/$project_name.ipa -T $api_token -c
Copy the code
This is the reason why WE need FIR-CLI before. This paragraph is to upload the packaged IPA with fir cli command, and the corresponding FIR token needs to log in to fir.im to obtain
At this point, the basic work is done, the terminal CD goes to your project directory scripts, and you just run the.sh file and it’s automatically packaged
bash -l dev_config.sh
Copy the code
If something happens in the project directory one level up there will be a folder with something like this in it
Package as Mac application
In fact, the above step is basically complete, but as a programmer should be lazy, here we can use Mac built-in automation to encapsulate the terminal command save
Then you will have your own automatic packaging robot, double click to run directly automatic packaging upload to fir
Six possible problems
- If an error is reported during robot execution or an empty folder is produced after packaging, it may be an environment configuration problem and you need to start the configuration again
- If you pack it up, it’s just
.xcarchive
If yes, the certificate configuration is incorrect and you need to check the certificate again - If there is a generation
.api
But it didn’t work last timefir.im
It could be inputfir token
Wrong, orfil-cil
Installation failed