追記
Codemagic 自体に機能が追加された ので、今はそれを使うべきです。
(この記事は、ログとして一応残しておきます)
参考
CodemagicでFlutterアプリのビルド・配信をする — iOS編
Codemagic のアプデを受け、上記の素晴らしい記事に補足で行った対応です。
手順
1. Script を準備
codemagic/pre_build.sh
#!/bin/sh
# NOTE: codemagic の UI から以下の環境変数をセットすること
# • FLAVOR: "development" / "staging" / "release"
# • CONFIGURATION: "Debug" / "Release"
set -e # exit on first failed commandset
set -x # print all executed commands to the log
echo "----- Using Environment Variables -----"
echo "CONFIGURATION: ${CONFIGURATION}"
echo "FLAVOR: ${FLAVOR}"
# Provisioning Profile の解決をする際に合致しないIDを取ってきてしまう件の対策
/usr/bin/plutil -replace CFBundleIdentifier -string "com.done.sensuikan1973.sample.${FLAVOR}" ios/Runner/Info.plist
# xcodebuid の際に決め打ちで -scheme Runner -config Release のオプションが与えられちゃってる件の対策
cp "ios/Flutter/${CONFIGURATION}-${FLAVOR}.xcconfig" ios/Flutter/Release-production.xcconfigs
同じ内容で codemagic/pre_test.sh
も作っておく。 integration test のための build でこけてしまうのを防ぎたいから。
2. Codemagic の UI から設定
3. 完了
もっと良い方法などありましたら🙏