likes
comments
collection
share

Flutter 打包 | Xcode Cloud 使用

作者站长头像
站长
· 阅读数 5

前言

一般我是不会用这些奇怪的东西的,但无奈更新了Xcode 14.3以后这个东西很耀眼地整出来了。所以这次我就写一下怎么用吧。

正文

这个首先需要你打开Xcode想要设置Xcode cloud的那个项目。

创建Xcloud

主要按着Xcode的默认配置就行了。这些后面都是可以改的。

Flutter 打包 | Xcode Cloud 使用

主要配置脚本.sh

首先,创建一个sh文件。

Flutter 打包 | Xcode Cloud 使用

然后在sh文件中填入以下内容。注意的是,我这个是使用Flutter固定的版本如3.3.9,假如使用官方提供的(),可能默认就是最新的。

#!/bin/sh

# 1. 进入当前工作目录
cd $CI_WORKSPACE # change working directory to the root of your cloned repo.

# 2.0 安装 Flutter特定版本.
git clone https://github.com/flutter/flutter.git -b stable $HOME/flutter
export PATH="$PATH:$HOME/flutter/bin"

cd $HOME/flutter
git checkout b8f7f1f9869bb2d116aa6a70dbeac61000b52849 # 切换Flutter的3.3.9版本

# 2.1 使用官方方式默认安装Flutter版本(已注释),2.1或者2.0两个代码只可以使用一个
# Install Flutter using git.
# git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter
# export PATH="$PATH:$HOME/flutter/bin"

cd $CI_WORKSPACE

# 3. 安装 Flutter artifacts iOS版 (--ios), 或 macOS版 (--macos).
flutter precache --ios

# 安装Flutter依赖
flutter pub get

# 使用 Homebrew 安装 CocoaPods .
HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates.
brew install cocoapods

# 安装 CocoaPods 依赖
cd ios && pod install # run `pod install` in the `ios` directory.

# Build ios app
flutter build ios --release --no-codesign

exit 0

⚠️注意事项

  1. 构建版本号 记得改Xcloud下一个构建版本编号,这个Xcloud会自动修改更新的。

Flutter 打包 | Xcode Cloud 使用

  1. 记得修改版本号 就是Version部分,这部分Xcloud不会帮你修改。

Flutter 打包 | Xcode Cloud 使用

最后

然后就可以啦。有不懂在评论区交流吧!