Skip to content

Commit fef25de

Browse files
authored
Merge pull request #441 from OpenPecha/develop
Develop
2 parents f6e5c2c + 6e97f3b commit fef25de

1 file changed

Lines changed: 197 additions & 0 deletions

File tree

codemagic.yaml

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# Codemagic CI/CD configuration for WeBuddhist (flutter_pecha)
2+
# ---------------------------------------------------------------------------
3+
# This file replaces the Workflow Editor so the Xcode scheme is named
4+
# EXPLICITLY (--flavor <env>) and never depends on Codemagic's cached scheme
5+
# detection — which is what caused: Scheme "prod" not found from repository.
6+
#
7+
# One-time setup in the Codemagic UI (Teams/App settings > Environment variables
8+
# and Integrations). Create these variable groups and connect integrations:
9+
#
10+
# Group "app_store_connect" (mark values as secure):
11+
# - APP_STORE_CONNECT_ISSUER_ID
12+
# - APP_STORE_CONNECT_KEY_IDENTIFIER
13+
# - APP_STORE_CONNECT_PRIVATE_KEY
14+
# - CERTIFICATE_PRIVATE_KEY # PEM private key for the distribution cert
15+
# Group "google_play":
16+
# - GCLOUD_SERVICE_ACCOUNT_CREDENTIALS # JSON for a Play service account
17+
# Group "app_secrets" (whatever ios/Flutter/Secrets.xcconfig + Android expect):
18+
# - AIRBRIDGE_SDK_TOKEN
19+
# - (any other secret build-time values)
20+
#
21+
# Android signing: upload your keystore under App settings > Code signing identities
22+
# with the reference name "webuddhist_keystore". Codemagic then injects
23+
# CM_KEYSTORE_PATH / CM_KEYSTORE_PASSWORD / CM_KEY_ALIAS / CM_KEY_PASSWORD,
24+
# which android/app/build.gradle.kts already reads for CI builds.
25+
#
26+
# iOS signing: connect the App Store Connect integration named "AppStoreConnect"
27+
# (Team settings > Integrations) so ios_signing can fetch managed profiles.
28+
# ---------------------------------------------------------------------------
29+
30+
definitions:
31+
instance: &instance
32+
instance_type: mac_mini_m2
33+
max_build_duration: 90
34+
35+
cache: &cache
36+
cache_paths:
37+
- $HOME/.pub-cache
38+
- $HOME/Library/Caches/CocoaPods
39+
- $FLUTTER_ROOT/.pub-cache
40+
41+
scripts:
42+
- &pub_get
43+
name: Flutter pub get (generates ios/Flutter/Generated.xcconfig)
44+
script: |
45+
flutter pub get
46+
47+
- &pod_install
48+
name: Pod install
49+
script: |
50+
find . -name "Podfile" -execdir pod install \;
51+
52+
- &flutter_doctor
53+
name: Flutter doctor & versions
54+
script: |
55+
set -x
56+
flutter --version
57+
flutter doctor -v
58+
# Sanity check: the flavor scheme must be visible to xcodebuild.
59+
xcodebuild -workspace ios/Runner.xcworkspace -list
60+
61+
- &set_ios_profiles
62+
name: Set up iOS code signing profiles
63+
script: |
64+
xcode-project use-profiles
65+
66+
artifacts: &artifacts
67+
- build/**/outputs/**/*.aab
68+
- build/**/outputs/**/mapping.txt
69+
- build/ios/ipa/*.ipa
70+
- "/tmp/xcodebuild_logs/*.log"
71+
- flutter_drive.log
72+
73+
workflows:
74+
# ===========================================================================
75+
# PRODUCTION (org.pecha.app)
76+
# ===========================================================================
77+
prod-release:
78+
name: Prod • iOS + Android release
79+
<<: *instance
80+
environment:
81+
<<: *cache
82+
flutter: stable
83+
xcode: latest
84+
cocoapods: default
85+
groups:
86+
- app_store_connect
87+
- google_play
88+
- app_secrets
89+
android_signing:
90+
- webuddhist_keystore
91+
ios_signing:
92+
distribution_type: app_store
93+
bundle_identifier: org.pecha.app
94+
vars:
95+
APP_FLAVOR: prod
96+
APP_ENTRYPOINT: lib/main_prod.dart
97+
APP_STORE_APPLE_ID: 0000000000 # TODO: replace with the prod App Store Apple ID
98+
triggering:
99+
events:
100+
- tag
101+
tag_patterns:
102+
- pattern: 'v*'
103+
include: true
104+
scripts:
105+
- *pub_get
106+
- *pod_install
107+
- *flutter_doctor
108+
- *set_ios_profiles
109+
- name: Build Android App Bundle
110+
script: |
111+
flutter build appbundle --release \
112+
--flavor "$APP_FLAVOR" -t "$APP_ENTRYPOINT"
113+
- name: Build iOS IPA
114+
script: |
115+
flutter build ipa --release \
116+
--flavor "$APP_FLAVOR" -t "$APP_ENTRYPOINT" \
117+
--export-options-plist=$HOME/export_options.plist
118+
artifacts: *artifacts
119+
publishing:
120+
app_store_connect:
121+
auth: integration
122+
submit_to_testflight: true
123+
# submit_to_app_store: false
124+
google_play:
125+
credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
126+
track: internal # Android internal testing
127+
submit_as_draft: false
128+
email:
129+
recipients:
130+
- tamdin@esukhia.org
131+
notify:
132+
success: true
133+
failure: true
134+
135+
# ===========================================================================
136+
# DEV (org.pecha.app.dev) — build + distribute to internal testing
137+
# ===========================================================================
138+
dev-release:
139+
name: Dev • iOS TestFlight + Android internal
140+
<<: *instance
141+
environment:
142+
<<: *cache
143+
flutter: stable
144+
xcode: latest
145+
cocoapods: default
146+
groups:
147+
- app_store_connect
148+
- google_play
149+
- app_secrets
150+
android_signing:
151+
- webuddhist_keystore
152+
ios_signing:
153+
distribution_type: app_store # required for TestFlight uploads
154+
bundle_identifier: org.pecha.app.dev
155+
vars:
156+
APP_FLAVOR: dev
157+
APP_ENTRYPOINT: lib/main_dev.dart
158+
triggering:
159+
events:
160+
- push
161+
branch_patterns:
162+
- pattern: develop
163+
include: true
164+
scripts:
165+
- *pub_get
166+
- *pod_install
167+
- *flutter_doctor
168+
- name: Analyze
169+
script: flutter analyze
170+
- name: Unit tests
171+
script: |
172+
flutter test || echo "No tests / tests failed (non-blocking for dev)"
173+
- *set_ios_profiles
174+
- name: Build Android App Bundle (dev)
175+
script: |
176+
flutter build appbundle --release \
177+
--flavor "$APP_FLAVOR" -t "$APP_ENTRYPOINT"
178+
- name: Build iOS IPA (dev)
179+
script: |
180+
flutter build ipa --release \
181+
--flavor "$APP_FLAVOR" -t "$APP_ENTRYPOINT" \
182+
--export-options-plist=$HOME/export_options.plist
183+
artifacts: *artifacts
184+
publishing:
185+
app_store_connect:
186+
auth: integration
187+
submit_to_testflight: true # iOS internal testing
188+
google_play:
189+
credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
190+
track: internal # Android internal testing
191+
submit_as_draft: false
192+
email:
193+
recipients:
194+
- tamdin@esukhia.org
195+
notify:
196+
success: true
197+
failure: true

0 commit comments

Comments
 (0)