@@ -83,7 +83,7 @@ if [[ ! -d ${buildToolsPath} ]]; then
83
83
fi
84
84
85
85
# Check if git flow is enabled
86
- gitFlowDevelop=` git config gitflow.branch.develop`
86
+ gitFlowDevelop=$( git config gitflow.branch.develop)
87
87
if [[ ${gitFlowDevelop} != " " ]]
88
88
then
89
89
printf " Git flow is initialized\n"
@@ -105,23 +105,23 @@ git pull
105
105
printf " \n================================================================================\n"
106
106
# Guessing version to propose a default version
107
107
versionsFile=" ./plugins/src/main/kotlin/Versions.kt"
108
- versionMajorCandidate=` grep " val versionMajor" ${versionsFile} | cut -d " " -f6`
109
- versionMinorCandidate=` grep " val versionMinor" ${versionsFile} | cut -d " " -f6`
110
- versionPatchCandidate=` grep " val versionPatch" ${versionsFile} | cut -d " " -f6`
108
+ versionMajorCandidate=$( grep " val versionMajor" ${versionsFile} | cut -d " " -f6)
109
+ versionMinorCandidate=$( grep " val versionMinor" ${versionsFile} | cut -d " " -f6)
110
+ versionPatchCandidate=$( grep " val versionPatch" ${versionsFile} | cut -d " " -f6)
111
111
versionCandidate=" ${versionMajorCandidate} .${versionMinorCandidate} .${versionPatchCandidate} "
112
112
113
113
read -p " Please enter the release version (example: ${versionCandidate} ). Just press enter if ${versionCandidate} is correct. " version
114
114
version=${version:- ${versionCandidate} }
115
115
116
116
# extract major, minor and patch for future use
117
- versionMajor=` echo ${version} | cut -d " ." -f1`
118
- versionMinor=` echo ${version} | cut -d " ." -f2`
119
- versionPatch=` echo ${version} | cut -d " ." -f3`
117
+ versionMajor=$( echo " ${version} " | cut -d " ." -f1)
118
+ versionMinor=$( echo " ${version} " | cut -d " ." -f2)
119
+ versionPatch=$( echo " ${version} " | cut -d " ." -f3)
120
120
nextPatchVersion=$(( versionPatch + 1 ))
121
121
122
122
printf " \n================================================================================\n"
123
123
printf " Starting the release ${version} \n"
124
- git flow release start ${version}
124
+ git flow release start " ${version} "
125
125
126
126
# Note: in case the release is already started and the script is started again, checkout the release branch again.
127
127
ret=$?
@@ -154,15 +154,15 @@ git commit -a -m "Changelog for version ${version}"
154
154
155
155
printf " \n================================================================================\n"
156
156
printf " Creating fastlane file...\n"
157
- printf -v versionMajor2Digits " %02d" ${versionMajor}
158
- printf -v versionMinor2Digits " %02d" ${versionMinor}
159
- printf -v versionPatch2Digits " %02d" ${versionPatch}
157
+ printf -v versionMajor2Digits " %02d" " ${versionMajor} "
158
+ printf -v versionMinor2Digits " %02d" " ${versionMinor} "
159
+ printf -v versionPatch2Digits " %02d" " ${versionPatch} "
160
160
fastlaneFile=" 4${versionMajor2Digits}${versionMinor2Digits}${versionPatch2Digits} 0.txt"
161
161
fastlanePathFile=" ./fastlane/metadata/android/en-US/changelogs/${fastlaneFile} "
162
- printf " Main changes in this version: TODO.\nFull changelog: https://github.com/element-hq/element-x-android/releases" > ${fastlanePathFile}
162
+ printf " Main changes in this version: TODO.\nFull changelog: https://github.com/element-hq/element-x-android/releases" > " ${fastlanePathFile} "
163
163
164
164
read -p " I have created the file ${fastlanePathFile} , please edit it and press enter to continue. "
165
- git add ${fastlanePathFile}
165
+ git add " ${fastlanePathFile} "
166
166
git commit -a -m " Adding fastlane file for version ${version} "
167
167
168
168
printf " \n================================================================================\n"
@@ -173,7 +173,7 @@ printf "\n======================================================================
173
173
read -p " Done, push the branch 'main' and the new tag (yes/no) default to yes? " doPush
174
174
doPush=${doPush:- yes}
175
175
176
- if [ ${doPush} == " yes" ]; then
176
+ if [ " ${doPush} " == " yes" ]; then
177
177
printf " Pushing branch 'main' and tag 'v${version} '...\n"
178
178
git push origin main
179
179
git push origin " v${version} "
@@ -202,7 +202,7 @@ printf "\n======================================================================
202
202
read -p " Done, push the branch 'develop' (yes/no) default to yes? (A rebase may be necessary in case develop got new commits) " doPush
203
203
doPush=${doPush:- yes}
204
204
205
- if [ ${doPush} == " yes" ]; then
205
+ if [ " ${doPush} " == " yes" ]; then
206
206
printf " Pushing branch 'develop'...\n"
207
207
git push origin develop
208
208
else
@@ -220,74 +220,74 @@ printf "\n======================================================================
220
220
printf " Downloading the artifacts...\n"
221
221
222
222
python3 ./tools/github/download_all_github_artifacts.py \
223
- --token ${gitHubToken} \
224
- --runUrl ${runUrl} \
225
- --directory ${targetPath}
223
+ --token " ${gitHubToken} " \
224
+ --runUrl " ${runUrl} " \
225
+ --directory " ${targetPath} "
226
226
227
227
printf " \n================================================================================\n"
228
228
printf " Unzipping the F-Droid artifact...\n"
229
229
230
230
fdroidTargetPath=" ${targetPath} /fdroid"
231
- unzip ${targetPath} /elementx-app-fdroid-apks-unsigned.zip -d ${fdroidTargetPath}
231
+ unzip " ${targetPath} " /elementx-app-fdroid-apks-unsigned.zip -d " ${fdroidTargetPath} "
232
232
233
233
printf " \n================================================================================\n"
234
234
printf " Signing the FDroid APKs...\n"
235
235
236
- cp ${fdroidTargetPath} /app-fdroid-arm64-v8a-release.apk \
237
- ${fdroidTargetPath} /app-fdroid-arm64-v8a-release-signed.apk
238
- ${buildToolsPath} /apksigner sign \
236
+ cp " ${fdroidTargetPath} " /app-fdroid-arm64-v8a-release.apk \
237
+ " ${fdroidTargetPath} " /app-fdroid-arm64-v8a-release-signed.apk
238
+ " ${buildToolsPath} " /apksigner sign \
239
239
-v \
240
- --ks ${keyStorePath} \
241
- --ks-pass pass:${keyStorePassword} \
240
+ --ks " ${keyStorePath} " \
241
+ --ks-pass pass:" ${keyStorePassword} " \
242
242
--ks-key-alias elementx \
243
- --key-pass pass:${keyPassword} \
243
+ --key-pass pass:" ${keyPassword} " \
244
244
--min-sdk-version ${minSdkVersion} \
245
- ${fdroidTargetPath} /app-fdroid-arm64-v8a-release-signed.apk
245
+ " ${fdroidTargetPath} " /app-fdroid-arm64-v8a-release-signed.apk
246
246
247
- cp ${fdroidTargetPath} /app-fdroid-armeabi-v7a-release.apk \
248
- ${fdroidTargetPath} /app-fdroid-armeabi-v7a-release-signed.apk
249
- ${buildToolsPath} /apksigner sign \
247
+ cp " ${fdroidTargetPath} " /app-fdroid-armeabi-v7a-release.apk \
248
+ " ${fdroidTargetPath} " /app-fdroid-armeabi-v7a-release-signed.apk
249
+ " ${buildToolsPath} " /apksigner sign \
250
250
-v \
251
- --ks ${keyStorePath} \
252
- --ks-pass pass:${keyStorePassword} \
251
+ --ks " ${keyStorePath} " \
252
+ --ks-pass pass:" ${keyStorePassword} " \
253
253
--ks-key-alias elementx \
254
- --key-pass pass:${keyPassword} \
254
+ --key-pass pass:" ${keyPassword} " \
255
255
--min-sdk-version ${minSdkVersion} \
256
- ${fdroidTargetPath} /app-fdroid-armeabi-v7a-release-signed.apk
256
+ " ${fdroidTargetPath} " /app-fdroid-armeabi-v7a-release-signed.apk
257
257
258
- cp ${fdroidTargetPath} /app-fdroid-x86-release.apk \
259
- ${fdroidTargetPath} /app-fdroid-x86-release-signed.apk
260
- ${buildToolsPath} /apksigner sign \
258
+ cp " ${fdroidTargetPath} " /app-fdroid-x86-release.apk \
259
+ " ${fdroidTargetPath} " /app-fdroid-x86-release-signed.apk
260
+ " ${buildToolsPath} " /apksigner sign \
261
261
-v \
262
- --ks ${keyStorePath} \
263
- --ks-pass pass:${keyStorePassword} \
262
+ --ks " ${keyStorePath} " \
263
+ --ks-pass pass:" ${keyStorePassword} " \
264
264
--ks-key-alias elementx \
265
- --key-pass pass:${keyPassword} \
265
+ --key-pass pass:" ${keyPassword} " \
266
266
--min-sdk-version ${minSdkVersion} \
267
- ${fdroidTargetPath} /app-fdroid-x86-release-signed.apk
267
+ " ${fdroidTargetPath} " /app-fdroid-x86-release-signed.apk
268
268
269
- cp ${fdroidTargetPath} /app-fdroid-x86_64-release.apk \
270
- ${fdroidTargetPath} /app-fdroid-x86_64-release-signed.apk
271
- ${buildToolsPath} /apksigner sign \
269
+ cp " ${fdroidTargetPath} " /app-fdroid-x86_64-release.apk \
270
+ " ${fdroidTargetPath} " /app-fdroid-x86_64-release-signed.apk
271
+ " ${buildToolsPath} " /apksigner sign \
272
272
-v \
273
- --ks ${keyStorePath} \
274
- --ks-pass pass:${keyStorePassword} \
273
+ --ks " ${keyStorePath} " \
274
+ --ks-pass pass:" ${keyStorePassword} " \
275
275
--ks-key-alias elementx \
276
- --key-pass pass:${keyPassword} \
276
+ --key-pass pass:" ${keyPassword} " \
277
277
--min-sdk-version ${minSdkVersion} \
278
- ${fdroidTargetPath} /app-fdroid-x86_64-release-signed.apk
278
+ " ${fdroidTargetPath} " /app-fdroid-x86_64-release-signed.apk
279
279
280
280
printf " \n================================================================================\n"
281
281
printf " Please check the information below:\n"
282
282
283
283
printf " File app-fdroid-arm64-v8a-release-signed.apk:\n"
284
- ${buildToolsPath} /aapt dump badging ${fdroidTargetPath} /app-fdroid-arm64-v8a-release-signed.apk | grep package
284
+ " ${buildToolsPath} " /aapt dump badging " ${fdroidTargetPath} " /app-fdroid-arm64-v8a-release-signed.apk | grep package
285
285
printf " File app-fdroid-armeabi-v7a-release-signed.apk:\n"
286
- ${buildToolsPath} /aapt dump badging ${fdroidTargetPath} /app-fdroid-armeabi-v7a-release-signed.apk | grep package
286
+ " ${buildToolsPath} " /aapt dump badging " ${fdroidTargetPath} " /app-fdroid-armeabi-v7a-release-signed.apk | grep package
287
287
printf " File app-fdroid-x86-release-signed.apk:\n"
288
- ${buildToolsPath} /aapt dump badging ${fdroidTargetPath} /app-fdroid-x86-release-signed.apk | grep package
288
+ " ${buildToolsPath} " /aapt dump badging " ${fdroidTargetPath} " /app-fdroid-x86-release-signed.apk | grep package
289
289
printf " File app-fdroid-x86_64-release-signed.apk:\n"
290
- ${buildToolsPath} /aapt dump badging ${fdroidTargetPath} /app-fdroid-x86_64-release-signed.apk | grep package
290
+ " ${buildToolsPath} " /aapt dump badging " ${fdroidTargetPath} " /app-fdroid-x86_64-release-signed.apk | grep package
291
291
292
292
printf " \n"
293
293
read -p " Does it look correct? Press enter when it's done."
@@ -299,32 +299,32 @@ printf "\n======================================================================
299
299
printf " Unzipping the Gplay artifact...\n"
300
300
301
301
gplayTargetPath=" ${targetPath} /gplay"
302
- unzip ${targetPath} /elementx-app-gplay-bundle-unsigned.zip -d ${gplayTargetPath}
302
+ unzip " ${targetPath} " /elementx-app-gplay-bundle-unsigned.zip -d " ${gplayTargetPath} "
303
303
304
304
unsignedBundlePath=" ${gplayTargetPath} /app-gplay-release.aab"
305
305
signedBundlePath=" ${gplayTargetPath} /app-gplay-release-signed.aab"
306
306
307
307
printf " \n================================================================================\n"
308
308
printf " Signing file ${unsignedBundlePath} with build-tools version ${buildToolsVersion} for min SDK version ${minSdkVersion} ...\n"
309
309
310
- cp ${unsignedBundlePath} ${signedBundlePath}
310
+ cp " ${unsignedBundlePath} " " ${signedBundlePath} "
311
311
312
- ${buildToolsPath} /apksigner sign \
312
+ " ${buildToolsPath} " /apksigner sign \
313
313
-v \
314
- --ks ${keyStorePath} \
315
- --ks-pass pass:${keyStorePassword} \
314
+ --ks " ${keyStorePath} " \
315
+ --ks-pass pass:" ${keyStorePassword} " \
316
316
--ks-key-alias elementx \
317
- --key-pass pass:${keyPassword} \
317
+ --key-pass pass:" ${keyPassword} " \
318
318
--min-sdk-version ${minSdkVersion} \
319
- ${signedBundlePath}
319
+ " ${signedBundlePath} "
320
320
321
321
printf " \n================================================================================\n"
322
322
printf " Please check the information below:\n"
323
323
324
324
printf " Version code: "
325
- bundletool dump manifest --bundle=${signedBundlePath} --xpath=/manifest/@android:versionCode
325
+ bundletool dump manifest --bundle=" ${signedBundlePath} " --xpath=/manifest/@android:versionCode
326
326
printf " Version name: "
327
- bundletool dump manifest --bundle=${signedBundlePath} --xpath=/manifest/@android:versionName
327
+ bundletool dump manifest --bundle=" ${signedBundlePath} " --xpath=/manifest/@android:versionName
328
328
329
329
printf " \n"
330
330
read -p " Does it look correct? Press enter to continue. "
@@ -336,17 +336,17 @@ printf "\n======================================================================
336
336
read -p " Do you want to build the APKs from the app bundle? You need to do this step if you want to install the application to your device. (yes/no) default to yes " doBuildApks
337
337
doBuildApks=${doBuildApks:- yes}
338
338
339
- if [ ${doBuildApks} == " yes" ]; then
339
+ if [ " ${doBuildApks} " == " yes" ]; then
340
340
printf " Building apks...\n"
341
- bundletool build-apks --bundle=${signedBundlePath} --output=${gplayTargetPath} /elementx.apks \
341
+ bundletool build-apks --bundle=" ${signedBundlePath} " --output=" ${gplayTargetPath} " /elementx.apks \
342
342
--ks=./app/signature/debug.keystore --ks-pass=pass:android --ks-key-alias=androiddebugkey --key-pass=pass:android \
343
343
--overwrite
344
344
345
345
read -p " Do you want to install the application to your device? Make sure there is one (and only one!) connected device first. (yes/no) default to yes " doDeploy
346
346
doDeploy=${doDeploy:- yes}
347
- if [ ${doDeploy} == " yes" ]; then
347
+ if [ " ${doDeploy} " == " yes" ]; then
348
348
printf " Installing apk for your device...\n"
349
- bundletool install-apks --apks=${gplayTargetPath} /elementx.apks
349
+ bundletool install-apks --apks=" ${gplayTargetPath} " /elementx.apks
350
350
read -p " Please run the application on your phone to check that the upgrade went well. Press enter to continue. "
351
351
else
352
352
printf " APK will not be deployed!\n"
@@ -373,7 +373,7 @@ printf "\n======================================================================
373
373
body=" %3C%21--%20Copy%20paste%20the%20section%20of%20the%20file%20CHANGES.md%20for%20this%20release%20here%20--%3E"
374
374
githubCreateReleaseLink=" https://github.com/element-hq/element-x-android/releases/new?tag=v${version} &title=Element%20X%20Android%20v${version} &body=${body} "
375
375
printf " Creating the release on gitHub.\n"
376
- printf -- " Open this link: %s\n" ${githubCreateReleaseLink}
376
+ printf -- " Open this link: %s\n" " ${githubCreateReleaseLink} "
377
377
printf " Then\n"
378
378
printf " - copy paste the section of the file CHANGES.md for this release.\n"
379
379
printf " - click on the 'Generate releases notes' button.\n"
@@ -392,12 +392,12 @@ if [[ -z "${elementBotToken}" ]]; then
392
392
else
393
393
read -p " Send this message to the room (yes/no) default to yes? " doSend
394
394
doSend=${doSend:- yes}
395
- if [ ${doSend} == " yes" ]; then
395
+ if [ " ${doSend} " == " yes" ]; then
396
396
printf " Sending message...\n"
397
- transactionId=` openssl rand -hex 16`
397
+ transactionId=$( openssl rand -hex 16)
398
398
# Element Android internal
399
399
matrixRoomId=" !LiSLXinTDCsepePiYW:matrix.org"
400
- curl -X PUT --data $ " {\" msgtype\" :\" m.text\" ,\" body\" :\" ${message} \" }" -H " Authorization: Bearer ${elementBotToken} " https://matrix-client.matrix.org/_matrix/client/r0/rooms/${matrixRoomId} /send/m.room.message/\$ local.${transactionId}
400
+ curl -X PUT --data " {\" msgtype\" :\" m.text\" ,\" body\" :\" ${message} \" }" -H " Authorization: Bearer ${elementBotToken} " https://matrix-client.matrix.org/_matrix/client/r0/rooms/${matrixRoomId} /send/m.room.message/\$ local." ${transactionId} "
401
401
else
402
402
printf " Message not sent, please send it manually!\n"
403
403
fi
0 commit comments