This repository include scripts that Xcode automaticly package, upload ipa to AppStore, publish application to fir.im, publish application to pgyer.com.
ipa-build.sh and ipa-upload.sh scripts are based on xcodebuild, xcodebuild is a script Apple build Xcode projects and workspaces. You can archive the application, export ipa file and then upload the binary file to App Store. Run the command man xcodebuild to see more description.
fir-publish.sh script is based on fir-cli tool, see more fir-cli
pgyer-publish.sh script see the document of PGYER
- Copy all files into the root path of your Xcode project or workspace
- Type in some configuration in the scirpts, such as your
CertificatesandProfiles, your Apple Develope Account username and password, theAPI Tokenoffir.im, the user key and api key ofpgyer.com, see detail in anyone script. - Install
jq, the dependency ofpgyer-publish.sh. See How to install jq - Run scripts
./ipa-build.sh -c [-D | -T | -P | -E]
./ipa-build.sh -w [-D | -T | -P | -E]
ipa-build.sh
-D : Build with development certificate for debugging
-T : Build with Ad-hoc certificate for testing
-P : Build with production certificate for AppStore
-E : Build with enterprise certificate for Enterprise(In-house)
-w : Build xcode workspace
-c : Build xcode project
-n : Cleans the build directory before compling
Xcode7 use some plist files to configure archive exporting, such as complieBitcode, avaliable options like app-store, ad-hoc, development. Run the command xcodebuild --help to see more.
To simplify scripts, I created three option plists that configured the simplified configuration which meet the most basic requirements.
DevExportOptions.plist: configures archive exporting for developmentAdHocExportOptions.plist: configures archive exporting for Ad-HocAppStoreExportOptions.plist: configures archive exporting for App StoreEnterpriseExportOptions.plist: configures archive exporting for Enterprise(In-house)
- Two directories
archive: The folder of files archivedexport: The folder of ipa files exported
- Three files
ipa-build.log: The log file. If archive failed or export failed, you can see the logbuild_cmd.sh: Thexcodebuildarchive command scriptexport_cmd.sh:xcodebuildexport ipa command script
ipa-upload.sh must run after ipa-build.sh, it will descending sort all folders and files by project scheme, version number and generating time of ipa in the export directory, and then select the ipa file of the last folder to upload. So please watch out the output in the terminal, make sure it is uploading the correct file.
./ipa-upload.sh
run the script and then terminal will ask you whether validate before upload, type in YES just OK.
Get API Token from http://fir.im/apps/apitoken, type in the token in line 21.
fir-publish.sh must run after ipa-build.sh
./fir-publish.sh
If publish succeeded, it will generate a QR code in the path of ipa file, you can download and install the App by scanning the QR code.
If have not installed the dependency jq yet, you will get an error " jq: command not found "
Get user key and api key seeing https://www.pgyer.com/doc/view/upload_one_command, type in keys in line 21 - 22.
pgyer-publish.sh must run after ipa-build.sh
./pgyer-publish.sh
这个代码仓库包含了Xcode自动化打包、上传ipa到AppStore、发布应用到fir.im的一些脚本。
ipa-build.sh和ipa-upload.sh这两个脚本是基于xcodebuild编写的,xcodebuild是苹果的Xcode项目工程和工作空间的构建脚本。你可以使用它来打包App,导出ipa文件和上传二进制文件到App Store。运行命令man xcodebuild查看更多帮助。
fir-publish.sh脚本是基于fir-cli工具编写的,详见 fir-cli。
pgyer-publish.sh脚本请查看蒲公英的文档 使用一条命令快速上传应用
- 复制所有文件到你Xcode项目工程或工作空间的跟路径
- 在脚本中输入一些配置信息,比如证书和配置文件、苹果开发者账号的用户名和密码、
fir.im的API Token,pyer.com的user key和api key,在每个脚本中查看更详细的信息。 - 安装
pgyer-publish.sh的依赖库jq,查看 怎样安装jq - 运行脚本
./ipa-build.sh -c [-D | -T | -P | -E]
./ipa-build.sh -w [-D | -T | -P | -E]
ipa-build.sh
-D : 用调试证书构建,用于调试
-T : 用Ad-hoc证书构建,用于内测
-P : 用产品证书构建,用于App Store
-E : 用企业证书构建,用于企业内部(In-house)
-w : 构建Xcode工作空间
-c : 构建Xcode项目
-n : 构建前清空编译文件
Xcode7 使用一些plist文件来配置导出的文件,比如支持Bitcode,app-store,ad-hoc,development等可用选项。运行命令xcodebuild --help查看更多。
为了简化监本,我创建了3个导出选项的文件,用来配置最基本的简化配置。
DevExportOptions.plist: 配置导出的文件用于调试AdHocExportOptions.plist: 配置导出的文件用于Ad-HocAppStoreExportOptions.plist: 配置导出的文件用于App StoreEnterpriseExportOptions.plist: 配置导出的文件用于企业内部(In-house)
- 两个目录
archive: 归档的文件夹export: 存放导出的ipa的文件夹
- 三个文件
ipa-build.log: 日志文件。 如果归档失败或导出失败,可以查看日志。build_cmd.sh:xcodebuildarchive命令脚本export_cmd.sh:xcodebuild导出ipa命令脚本
ipa-upload.sh必须在运行完ipa-build.sh之后才可以运行,它会把export目录下的所有文件降序排序,然后选择排在最后的文件夹中的ipa文件进行上传。所以请仔细留意终端中的输出信息,确保正在上传的文件是正确的。
./ipa-upload.sh
运行脚本之后,终端会询问你是否要在上传之前进行校验,输入YES即可。
从 http://fir.im/apps/apitoken 获取API Token, 在第21行输入token。
fir-publish.sh 必须在运行完ipa-build.sh之后。
./fir-publish.sh
如果发布成功,会在ipa文件的路径下生成一个二维码,扫描二维码可以下载并安装App。
如果你还没有安装依赖库jq,将会报错:** jq: command not found **
查看 https://www.pgyer.com/doc/view/upload_one_command 获取 user key 和 api key, 并填写在第21和22行。
pgyer-publish.sh 必须在运行完ipa-build.sh之后运行。
./pgyer-publish.sh