一、自动化工具

首先需要对fastlane的几个自动化组件有一定了解,具体的功能以及文档如下:

  • cert:cert is part of fastlane: The easiest way to automate beta deployments and releases for your iOS and Android apps.
  • pem:Makes sure a valid push profile is active and creates a new one if needed
  • sign:sigh can create, renew, download and repair provisioning profiles (with one command). It supports App Store, Ad Hoc, Development and Enterprise profiles and supports nice features, like auto-adding all test devices.
  • produce:produce creates new iOS apps on both the Apple Developer Portal and iTunes Connect with the minimum required information.

二、自动化脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# ---- 需要修改的部分 ----
# 开发者账号
Username=xxx
# 密码
Password=xxx
# APP 拼音名字
AppName=xxx
# ----------------
# BundleID
BundleID=com.${AppName}.app
# 推送证书名字
PemName=tuisong
fastlane fastlane-credentials add --username ${Username} --password ${Password}
# 创建APP ID
fastlane produce -u ${Username} -a ${BundleID} -q ${AppName}App --skip_itc
# 创建开发者证书
fastlane cert -u ${Username}
# 创建并下载推送证书,导出的推送P12文件密码为123
fastlane pem -a ${BundleID} -u ${Username} --p12_password 123 --pem_name ${PemName}
# 创建并下载 Provisioning Profiles 文件
fastlane sigh -a ${BundleID} -u ${Username} --provisioning_name "${AppName}Appstore" -q "${AppName}Appstore.mobileprovision"
fastlane fastlane-credentials remove --username ${Username}