Xcode打开项目勾选自动签名,设置Team和Bundle Identifier
等待Xcode自动下载安装Certificates和Provisioning Profile
确认mac里已经安装开发者证书Certificates和Provisioning Profile
安装gitlab-runner在当前登录用户
注册本机作为Runner
将下面代码保存为.gitlab-ci.yml文件,修改配置参数后,放到项目根目录
stages:
- ipaUpload
flutter_build_package:
variables:
USER: "配置Apple ID"
PASS: "配置App-Specific Passwords"
POD_PATH: "配置cocoapods的bin文件夹路径"
FLUTTER_PATH: "配置flutter的bin文件夹路径"
stage: ipaUpload
only: # 推送标记时触发(正则匹配)
- /^release.*$/
- tags
before_script: # 配置打包环境变量
- export PATH=$FLUTTER_PATH:$PATH
- export PATH=$POD_PATH:$PATH
- flutter doctor
script: # 开始构建打包
- flutter clean
- flutter build ipa
- ls build/ios/ipa
after_script: # 开始上传文件
- xcrun altool --upload-app -t ios -f build/ios/ipa/*.ipa -u $USER -p $PASS
tags:
- flutter