想要在Xcode cloud clone git repo下來的時候,都會安裝 cocoapods 及 pod install,避免build失敗
git repot 放置位置: `ci_scripts/ci_post_clone.sh`
# ci_post_clone.sh
#!/bin/sh
echo "✅ [ci_post_clone.sh] 開始安裝 CocoaPods 和 Bundler..."
# 設定 PATH(先做!)
export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH"
# 安裝 Bundler 與 CocoaPods 到使用者目錄
gem install bundler -v 2.4.22 --user-install
gem install cocoapods --user-install
# 印出版本資訊作為驗證
echo "✅ Ruby 版本:$(ruby -v)"
echo "✅ Bundler 路徑:$(which bundler)"
echo "✅ CocoaPods 路徑:$(which pod)"
# 根據是否有 Gemfile 決定要不要用 bundler
if [ -f "Gemfile" ]; then
echo "📦 偵測到 Gemfile,執行 bundle install..."
bundle _2.4.22_ install
else
echo "📦 未偵測到 Gemfile,直接執行 pod install..."
pod install
fi
echo "✅ [ci_post_clone.sh] 已完成執行。"
exit 0
文章標籤
全站熱搜
