shell脚本实现自动化打包发布

要实现的功能
  • update代码
  • 编译打包app
  • 上传到fir.im
命令
  • 更新代码

cd /Users/xxx/xxx.xcworkspace
git pull

  • xcodebuild打包Archive文件

xcodebuild -workspace ${path to *.xcworkspace} -scheme ${scheme} -destination generic/platform=iOS archive -configuration Release ONLY_ACTIVE_ARCH=NO -archivePath ${export path *.xcarichive}

  • -workspace 对应xxx.xcworkspace
  • -scheme 对应 project的scheme
  • -configuration 对应Debug、Release
  • -archivePath 对应生成xxx.xcarichive的路径
  • 导出ipa

xcodebuild -exportArchive -archivePath ${path to *.xcarchive} -exportPath ${export path to dir} -exportOptionsPlist ${path to export options *.plist}

  • -archivePath 对应xxx.xcarchive的路径
  • -exportPath 对应生成的ipa的路径
  • -exportOptionsPlist 对应导出plist格式的配置文件
  • 上传到fir

fir login -T ${API token}
fir publish ${path to xxx.ipa}

  • 测试机打开自用AppStore更新最新版


    appstore.png
Tips
  • 查看project信息:xcodebuild -list
  • project需要设置SigningAutomatically manage signing
  • exportOptionPlist: 新建一个plist文件, 里面是一个Dictionary, key-value如下, 都是可选值, 不需要全部填上 :
  1. compileBitcode: Bool
    For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES.

  2. embedOnDemandResourcesAssetPacksInBundle : Bool
    For non-App Store exports, if the app uses On Demand Resources and this is YES, asset packs are embedded in the app bundle so that the app can be tested without a server to host asset packs. Defaults to YES unless onDemandResourcesAssetPacksBaseURL is specified.

  3. iCloudContainerEnvironment
    For non-App Store exports, if the app is using CloudKit, this configures the “com.apple.developer.icloud-container-environment” entitlement. Available options: Development and Production. Defaults to Development.

  4. manifest : Dictionary
    For non-App Store exports, users can download your app over the web by opening your distribution manifest file in a web browser. To generate a distribution manifest, the value of this key should be a dictionary with three sub-keys: appURL, displayImageURL, fullSizeImageURL. The additional sub-key assetPackManifestURL is required when using on demand resources.

  5. method : String
    Describes how Xcode should export the archive. Available options: app-store, ad-hoc, package, enterprise, development, and developer-id. The list of options varies based on the type of archive. Defaults to development.

  6. onDemandResourcesAssetPacksBaseURL : String
    For non-App Store exports, if the app uses On Demand Resources and embedOnDemandResourcesAssetPacksInBundle isn’t YES, this should be a base URL specifying where asset packs are going to be hosted. This configures the app to download asset packs from the specified URL.

  7. teamID : String
    The Developer Portal team to use for this export. Defaults to the team used to build the archive.

  8. thinning : String
    For non-App Store exports, should Xcode thin the package for one or more device variants? Available options: (Xcode produces a non-thinned universal app), (Xcode produces a universal app and all available thinned variants), or a model identifier for a specific device (e.g. “iPhone7,1”). Defaults to .

  9. uploadBitcode : Bool
    For App Store exports, should the package include bitcode? Defaults to YES.

  10. uploadSymbols : Bool
    For App Store exports, should the package include symbols? Defaults to YES.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,490评论 0 10
  • 一般我们可以使用Xcode来打包我们的项目,但是如果每天都需要花上20分钟来打包项目实在是很痛苦的事情,程序员是最...
    青天揽明月阅读 4,019评论 3 17
  • 因为需要,最近在研究用脚本编译.ipa文件,在网上查找了不少资料,发现都是一些比较旧的操作了,在应用的时候难免会有...
    wendy_le阅读 1,750评论 1 2
  • XcodeBuild命令介绍 原料:Xcode 7.3 Build version 7D175 使用方法一: 使用...
    影之封封阅读 15,438评论 0 27
  • 从2018年1月6号,小修版本提交之后,就一直每天多次查看状态,中间无心做别的事情,心神不宁,我也知道无论结果怎样...
    我没表情阅读 84评论 0 1