This repository was archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodemagic.yaml
201 lines (194 loc) · 5.21 KB
/
codemagic.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
definitions:
rn_env: &rn_env
BUILD_NUMBER: $BUILD_NUMBER
REPO: $CM_REPO_SLUG
COMMIT_SHA: $CM_COMMIT
notify_email: ¬ify_email
email:
recipients:
notify:
success: true
failure: true
production_triggering: &production_triggering
cancel_previous_builds: true
events:
- push
branch_patterns:
- pattern: "main|beta"
scripts:
- &install_doppler
name: Import Doppler secrets
script: |
brew install gnupg
brew install dopplerhq/cli/doppler
doppler secrets download --no-read-env \
--no-file \
--format env-no-quotes \
--config $APP_ENV \
--token $DOPPLER_TOKEN >> $CM_ENV
- &make_env_file
name: Make .env file
script: |
node ./scripts/make.env.js
- &install_bundler
name: Install bundler
script: |
gem install bundler
bundle install
- &install_imagemagick
name: Install imagemagick
script: |
brew install imagemagick
- &install_pod_dep
name: Pod install
script: |
cd ios && pod install
- &install_rn_dep
name: Yarn install
script: |
rm patches/react-native-bootsplash+5.1.4.patch
yarn --version
yarn --production=false --frozen-lockfile
- &mod_google_service_plist
name: Mod GoogleService-Info.plist
script: |
cat ios/GoogleService-Info.${APP_ENV}.plist > ios/GoogleService-Info.plist
- &mod_google_service_json
name: Mod google-services.json
script: |
if [ -z "${AND_GOOGLE_SERVICES_JSON}" ]; then
echo "Not modifying google-services.json"
else
GOOGLE_SERVICE_JSON_LOCATION=$CM_BUILD_DIR/android/app/google-services.json
echo "Modifying $GOOGLE_SERVICE_JSON_LOCATION"
echo "$AND_GOOGLE_SERVICES_JSON" | base64 -d > $GOOGLE_SERVICE_JSON_LOCATION
fi
- &install_android_ndk
name: Install Android NDK
script: |
export ANDROID_NDK_HOME="$HOMEBREW_PREFIX/share/android-ndk"
if [ ! -d "$ANDROID_NDK_HOME" ]; then
brew install --cask android-ndk
else
echo "Android NDK already installed"
fi
- &create_firebase_credentials
name: Create Firebase Credentials
script: |
echo "$FIREBASE_SERVICE_ACCOUNT" | base64 -d > $CM_BUILD_DIR/firebase_credentials.json
if [ -n "$AND_PLAY_STORE_AUTH_JSON" ] && [ -n "$FASTLANE_ANDROID_JSON_KEY_FILE" ]; then
echo "$AND_PLAY_STORE_AUTH_JSON" | base64 -d > $CM_BUILD_DIR/$FASTLANE_ANDROID_JSON_KEY_FILE
fi
- &build_app
name: Build Application
script: |
bundle exec fastlane $PLATFORM $LANE
build_android: &build_android
max_build_duration: 30
instance_type: mac_mini_m1
artifacts:
- android/**/*.apk
- android/**/*.aab
cache:
cache_paths:
- $CM_BUILD_DIR/node_modules
- $HOME/Library/Caches/Yarn
- $CM_BUILD_DIR/.bundle/packages
- $CM_BUILD_DIR/android/.gradle
- $HOMEBREW_PREFIX/share/android-ndk
scripts:
- *install_bundler
- *install_imagemagick
- *install_android_ndk
- *install_doppler
- *install_rn_dep
- *make_env_file
- *create_firebase_credentials
- *mod_google_service_json
- *build_app
build_ios: &build_ios
instance_type: mac_mini_m1
artifacts:
- $CM_BUILD_DIR/ios/build
max_build_duration: 30
cache:
cache_paths:
- $CM_BUILD_DIR/node_modules
- $HOME/Library/Caches/Yarn
- $CM_BUILD_DIR/.bundle/packages
- $CM_BUILD_DIR/ios/Pods
- $CM_BUILD_DIR/ios/build/DerivedData
scripts:
- *install_bundler
- *install_imagemagick
- *install_doppler
- *install_rn_dep
- *install_pod_dep
- *make_env_file
- *mod_google_service_plist
- *create_firebase_credentials
- *build_app
workflows:
android-staging:
<<: *build_android
name: Android Staging
environment:
java: 17
groups:
- Global
- Staging
vars:
<<: *rn_env
PLATFORM: android
APP_ENV: staging
LANE: staging
android-beta:
<<: [*build_android]
name: Android Beta
publishing:
<<: *notify_email
environment:
java: 17
groups:
- Global
- Production
vars:
<<: *rn_env
PLATFORM: android
APP_ENV: production
LANE: beta
ios-staging:
<<: [*build_ios]
name: iOS Staging
environment:
xcode: latest
cocoapods: default
groups:
- Global
- Staging
vars:
<<: *rn_env
PLATFORM: ios
APP_ENV: staging
LANE: staging
SENTRY_DSYM_PATH: $CM_BUILD_DIR/ios/build/Avi.app.dSYM.zip
ios-beta:
<<: [*build_ios]
publishing:
<<: *notify_email
name: iOS Beta
artifacts:
- android/app/build/**/*.aab
environment:
xcode: latest
cocoapods: default
groups:
- Global
- Production
vars:
<<: *rn_env
PLATFORM: ios
APP_ENV: production
LANE: beta
SENTRY_DSYM_PATH: $CM_BUILD_DIR/ios/build/Avi.app.dSYM.zip