-
Notifications
You must be signed in to change notification settings - Fork 16
/
bitrise.yml
353 lines (338 loc) · 15.1 KB
/
bitrise.yml
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
format_version: "4"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: react-native
app:
envs:
- PROJECT_LOCATION: android
- MODULE: app
opts:
is_expand: false
- VARIANT: ""
opts:
is_expand: false
- BITRISE_PROJECT_PATH: ios/mapeo.xcodeproj
opts:
is_expand: false
- BITRISE_SCHEME: mapeo
opts:
is_expand: false
- BITRISE_EXPORT_METHOD: ad-hoc
opts:
is_expand: false
workflows:
deploy-internal:
description: Deploy for internal dev testing
before_run:
- primary
envs:
- GRADLE_TASKS: assembleQaDebug assembleIccaRelease
opts:
is_expand: false
steps:
- script@1.1.6:
title: Rename APKs
inputs:
- content:
"#!/usr/bin/env bash\n\n# Renames the apks with the current datetime
and a \n# reference the git commit and the bitrise build slug\n\nset -eE
-o pipefail\nshopt -s extdebug\n\n# Split the path_list variable by |
into an array\nIFS='|' read -r -a paths <<< \"$BITRISE_APK_PATH_LIST\"\nnew_paths=()\ndatestring=$(date
-u +\"%Y%m%d_%H%M%S\")\n\nfor path in \"${paths[@]}\"\ndo\n # Just the
path portion\n dir=\"${path%/*}\"\n # Just the filename without extensions\n
\ basename=\"${path##*/}\"\n basename=\"${basename%.apk*}\"\n # Construct
path with new filename\n new_path=\"${dir}/${datestring}-${basename}\"\n
\ if [ -n \"${BITRISE_PULL_REQUEST}\" ]; then\n new_path+=\"_PR#${BITRISE_PULL_REQUEST}\"\n
\ fi\n if [ -n \"${BITRISE_GIT_COMMIT}\" ]; then\n new_path+=\"_${BITRISE_GIT_COMMIT:0:7}\"\n
\ fi\n new_path+=\".apk\"\n mv \"$path\" \"$new_path\"\n echo \"Moved
${path} --> ${new_path}\"\n new_paths+=(\"$new_path\")\ndone\n\n# Join
the path_list array into a string separated by |\nIFS=\\| eval 'NEW_APK_PATH_LIST=\"${new_paths[*]}\"'\n\n#
Save the variable to the env so it is accessible in other build steps\nenvman
add --key BITRISE_APK_PATH_LIST --value \"$NEW_APK_PATH_LIST\"\n"
- deploy-to-bitrise-io@1.9.6: {}
meta:
bitrise.io: null
stack: linux-docker-android
deploy-release:
description: Deploy release builds
before_run:
- primary
envs:
- GRADLE_TASKS: assembleApp assembleIccaRelease bundleAppUniversal -x assembleAppDebug
opts:
is_expand: false
steps:
- script@1.1.6:
title: Rename APKs
inputs:
- content:
"#!/usr/bin/env bash\n\n# Renames the apks with the current datetime
and a \n# reference the git commit and the bitrise build slug\n\nset -eE
-o pipefail\nshopt -s extdebug\n\n# Split the path_list variable by |
into an array\nIFS='|' read -r -a paths <<< \"$BITRISE_APK_PATH_LIST\"\nnew_paths=()\n\nfor
path in \"${paths[@]}\"\ndo\n # Just the path portion\n dir=\"${path%/*}\"\n
\ # Just the filename\n filename=\"${path##*/}\"\n # Add version name\n
\ filename=\"${filename/mapeo-/mapeo-v$ANDROID_VERSION_NAME-}\"\n # Uppercase
flavor or remove\n filename=\"${filename/-qa-/-QA-}\"\n filename=\"${filename/-icca-release/-ICCA}\"\n
\ filename=\"${filename/-app-release/}\"\n filename=\"${filename/-app-/-}\"\n
\ # Construct path with new filename\n new_path=\"${dir}/${filename}\"\n
\ mv \"$path\" \"$new_path\"\n echo \"Moved ${path} --> ${new_path}\"\n
\ new_paths+=(\"$new_path\")\ndone\n\n# Join the path_list array into
a string separated by |\nIFS=\\| eval 'NEW_APK_PATH_LIST=\"${new_paths[*]}\"'\n\n#
Save the variable to the env so it is accessible in other build steps\nenvman
add --key BITRISE_APK_PATH_LIST --value \"$NEW_APK_PATH_LIST\"\n"
- deploy-to-bitrise-io@1.9.6: {}
- script@1.1.6:
title: Set APK path variables
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo "SOURCE_DIR = ${BITRISE_SOURCE_DIR}"
RELEASE_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*[0-9]\.apk)
UNIVERSAL_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*[0-9]-universal\.apk)
ICCA_RELEASE_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*ICCA\.apk)
envman add --key RELEASE_APK_PATH --value "$RELEASE_APK_PATH"
envman add --key UNIVERSAL_APK_PATH --value "$UNIVERSAL_APK_PATH"
envman add --key ICCA_RELEASE_APK_PATH --value "$ICCA_RELEASE_APK_PATH"
- amazon-s3-uploader@1.0.1:
title: Upload APK for Arm
inputs:
- aws_access_key: $AWS_ACCESS_KEY_ID
- aws_secret_key: $AWS_SECRET_ACCESS_KEY
- bucket_name: mapeo-apks
- path_in_bucket: release/v${VERSION_NAME}
- file_path: $RELEASE_APK_PATH
- script@1.1.6:
title: Update download URL for release
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
node ./scripts/gh-pages-redirect.js /latest https://mapeo-apks.s3.amazonaws.com/release/v${VERSION_NAME}/${RELEASE_APK_PATH##*/}
- amazon-s3-uploader@1.0.1:
title: Upload universal (all ABIs) APK
inputs:
- aws_access_key: $AWS_ACCESS_KEY_ID
- aws_secret_key: $AWS_SECRET_ACCESS_KEY
- bucket_name: mapeo-apks
- path_in_bucket: release/v${VERSION_NAME}
- file_path: $UNIVERSAL_APK_PATH
- amazon-s3-uploader@1.0.1:
title: Upload APK for ICCA (Arm)
inputs:
- aws_access_key: $AWS_ACCESS_KEY_ID
- aws_secret_key: $AWS_SECRET_ACCESS_KEY
- bucket_name: mapeo-apks
- path_in_bucket: release-ICCA
- file_path: $ICCA_RELEASE_APK_PATH
- script@1.1.6:
title: Update download URL for ICCA
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
node ./scripts/gh-pages-redirect.js /icca/latest https://mapeo-apks.s3.amazonaws.com/release-ICCA/${ICCA_RELEASE_APK_PATH##*/}
- script@1.1.6:
title: Generate release description
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
RELEASE_DESCRIPTION=$(printf "$(npm run --silent release-notes | tail -n +3)\n\n### [Known Issues](KNOWN_ISSUES.md)\n")
envman add --key RELEASE_DESCRIPTION --value "$RELEASE_DESCRIPTION"
- github-release@0.11.0:
inputs:
- username: $GITHUB_USERNAME
- name: $BITRISE_GIT_TAG
- draft: "no"
- files_to_upload: $RELEASE_APK_PATH
- body: $RELEASE_DESCRIPTION
- api_token: $GITHUB_TOKEN
- google-play-deploy@3.0.2:
inputs:
- service_account_json_key_path: $BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL
- track: beta
- apk_path: $RELEASE_APK_PATH
- app_path: $BITRISE_AAB_PATH
- package_name: com.mapeo
meta:
bitrise.io: null
stack: linux-docker-android
deploy-release-candidate:
description: Deploy beta versions for testing
before_run:
- primary
envs:
- GRADLE_TASKS: assembleQaDebug assembleAppUniversal assembleIccaUniversal
opts:
is_expand: false
steps:
- script@1.1.6:
title: Rename APKs
inputs:
- content:
"#!/usr/bin/env bash\n\n# Renames the apks with the current datetime
and a \n# reference the git commit and the bitrise build slug\n\nset -eE
-o pipefail\nshopt -s extdebug\n\n# Split the path_list variable by |
into an array\nIFS='|' read -r -a paths <<< \"$BITRISE_APK_PATH_LIST\"\nnew_paths=()\n\nfor
path in \"${paths[@]}\"\ndo\n # Just the path portion\n dir=\"${path%/*}\"\n
\ # Just the filename\n filename=\"${path##*/}\"\n # Add version name\n
\ filename=\"${filename/mapeo-/mapeo-v$ANDROID_VERSION_NAME-}\"\n # Uppercase
flavor or remove\n filename=\"${filename/-qa-/-QA-}\"\n filename=\"${filename/-icca-/-ICCA-}\"\n
\ filename=\"${filename/-app-/-}\"\n # Construct path with new filename\n
\ new_path=\"${dir}/${filename}\"\n mv \"$path\" \"$new_path\"\n echo
\"Moved ${path} --> ${new_path}\"\n new_paths+=(\"$new_path\")\ndone\n\n#
Join the path_list array into a string separated by |\nIFS=\\| eval 'NEW_APK_PATH_LIST=\"${new_paths[*]}\"'\n\n#
Save the variable to the env so it is accessible in other build steps\nenvman
add --key BITRISE_APK_PATH_LIST --value \"$NEW_APK_PATH_LIST\"\n"
- script@1.1.6:
title: Set APK path variables
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
UNIVERSAL_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*[0-9]-universal\.apk)
QA_DEBUG_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*QA-debug\.apk)
ICCA_UNIVERSAL_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*ICCA-universal\.apk)
envman add --key UNIVERSAL_APK_PATH --value "$UNIVERSAL_APK_PATH"
envman add --key QA_DEBUG_APK_PATH --value "$QA_DEBUG_APK_PATH"
envman add --key ICCA_UNIVERSAL_APK_PATH --value "$ICCA_UNIVERSAL_APK_PATH"
- deploy-to-bitrise-io@1.9.5: {}
- amazon-s3-uploader@1.0.1:
title: Upload QA variant
is_skippable: true
inputs:
- aws_access_key: $AWS_ACCESS_KEY_ID
- aws_secret_key: $AWS_SECRET_ACCESS_KEY
- bucket_name: mapeo-apks
- path_in_bucket: beta-testing/v${VERSION_NAME}
- file_path: $QA_DEBUG_APK_PATH
- amazon-s3-uploader@1.0.1:
title: Upload Release variant
is_skippable: true
inputs:
- aws_access_key: $AWS_ACCESS_KEY_ID
- aws_secret_key: $AWS_SECRET_ACCESS_KEY
- bucket_name: mapeo-apks
- path_in_bucket: beta-testing/v${VERSION_NAME}
- file_path: $UNIVERSAL_APK_PATH
- amazon-s3-uploader@1.0.1:
title: Upload ICCA variant
is_skippable: true
inputs:
- aws_access_key: $AWS_ACCESS_KEY_ID
- aws_secret_key: $AWS_SECRET_ACCESS_KEY
- bucket_name: mapeo-apks
- path_in_bucket: beta-testing/v${VERSION_NAME}
- file_path: $ICCA_UNIVERSAL_APK_PATH
meta:
bitrise.io: null
stack: linux-docker-android
noop: {}
primary:
description: Build Android apk & aab
steps:
- nvm@1.2.2:
inputs:
- node_version: " "
- npm@1.1.3:
title: Update npm
inputs:
- command: install -g --force npm@^6.13
- npm@1.1.3:
title: npm ci
inputs:
- npm_version: ""
- command: ci
- file-downloader@1.0.1:
title: Download Release keystore
run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}'
inputs:
- destination: $PROJECT_LOCATION/app/mapeo-release-key.keystore
- source: $BITRISEIO_ANDROID_KEYSTORE_URL
- script@1.1.6:
title: Update SDK components
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
ANDROID_NDK_VERSION='21.4.7075529'
echo '### User Sources for Android SDK Manager' > $HOME/.android/repositories.cfg
yes | sdkmanager --licenses
sdkmanager --update | grep -v = || true
# Remove NDK r22 (can cause builds to fail)
rm -rf $ANDROID_HOME/ndk/22*
sdkmanager --install "ndk;${ANDROID_NDK_VERSION}"
echo "Updated to latest SDK:"
sdkmanager --list
- script-runner@0.9.3:
title: Build nodejs backend
inputs:
- file_path: scripts/build-backend.sh
- npm@1.1.3:
title: Build translations
inputs:
- npm_version: ""
- command: run build:translations
- script@1.1.6:
title: Set version name & code
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
VERSION_NAME=`node -p "require('./package.json').version"`
if [[ "$BITRISE_GIT_BRANCH" == "deploy" || -n "$BITRISE_GIT_TAG" ]]; then
# This is a push to deploy event or a tag event
# Pushing a tag to Github for some reason triggers this workflow with $BITRISE_GIT_BRANCH set to master
ANDROID_VERSION_NAME="${VERSION_NAME}.${BITRISE_BUILD_NUMBER}"
elif [ "${BITRISE_GIT_BRANCH%/*}" == "release" ]; then
# This is a push to a branch matching `release/*`, so we build a release candidate
ANDROID_VERSION_NAME="${VERSION_NAME}-RC.${BITRISE_BUILD_NUMBER}"
else
# This is an internal build
ANDROID_VERSION_NAME="Internal.${BITRISE_BUILD_NUMBER}"
fi
envman add --key VERSION_NAME --value $VERSION_NAME
envman add --key ANDROID_VERSION_NAME --value $ANDROID_VERSION_NAME
envman add --key ANDROID_VERSION_CODE --value $BITRISE_BUILD_NUMBER
- change-workdir@1.0.2:
is_always_run: true
inputs:
- is_create_path: "false"
- path: $PROJECT_LOCATION
- gradle-runner@1.9.3:
inputs:
- gradlew_path: ./gradlew
- app_file_exclude_filter: |-
*unaligned.apk
*Test*.apk
mapeo-debug*.apk
- gradle_task: $GRADLE_TASKS
- change-workdir@1.0.2:
inputs:
- is_create_path: "false"
- path: ..
meta:
bitrise.io: null
stack: linux-docker-android