@ -83,7 +83,7 @@ if [[ ! -d ${buildToolsPath} ]]; then
fi
fi
# Check if git flow is enabled
# Check if git flow is enabled
gitFlowDevelop = ` git config gitflow.branch.develop`
gitFlowDevelop = $( git config gitflow.branch.develop)
if [ [ ${ gitFlowDevelop } != "" ] ]
if [ [ ${ gitFlowDevelop } != "" ] ]
then
then
printf "Git flow is initialized\n"
printf "Git flow is initialized\n"
@ -105,23 +105,23 @@ git pull
printf "\n================================================================================\n"
printf "\n================================================================================\n"
# Guessing version to propose a default version
# Guessing version to propose a default version
versionsFile = "./plugins/src/main/kotlin/Versions.kt"
versionsFile = "./plugins/src/main/kotlin/Versions.kt"
versionMajorCandidate = ` grep "val versionMajor" ${ versionsFile } | cut -d " " -f6`
versionMajorCandidate = $( grep "val versionMajor" ${ versionsFile } | cut -d " " -f6)
versionMinorCandidate = ` grep "val versionMinor" ${ versionsFile } | cut -d " " -f6`
versionMinorCandidate = $( grep "val versionMinor" ${ versionsFile } | cut -d " " -f6)
versionPatchCandidate = ` grep "val versionPatch" ${ versionsFile } | cut -d " " -f6`
versionPatchCandidate = $( grep "val versionPatch" ${ versionsFile } | cut -d " " -f6)
versionCandidate = " ${ versionMajorCandidate } . ${ versionMinorCandidate } . ${ versionPatchCandidate } "
versionCandidate = " ${ versionMajorCandidate } . ${ versionMinorCandidate } . ${ versionPatchCandidate } "
read -p " Please enter the release version (example: ${ versionCandidate } ). Just press enter if ${ versionCandidate } is correct. " version
read -p " Please enter the release version (example: ${ versionCandidate } ). Just press enter if ${ versionCandidate } is correct. " version
version = ${ version :- ${ versionCandidate } }
version = ${ version :- ${ versionCandidate } }
# extract major, minor and patch for future use
# extract major, minor and patch for future use
versionMajor = ` echo ${ version } | cut -d "." -f1`
versionMajor = $( echo " ${ version } " | cut -d "." -f1)
versionMinor = ` echo ${ version } | cut -d "." -f2`
versionMinor = $( echo " ${ version } " | cut -d "." -f2)
versionPatch = ` echo ${ version } | cut -d "." -f3`
versionPatch = $( echo " ${ version } " | cut -d "." -f3)
nextPatchVersion = $(( versionPatch + 1 ))
nextPatchVersion = $(( versionPatch + 1 ))
printf "\n================================================================================\n"
printf "\n================================================================================\n"
printf " Starting the release ${ version } \n "
printf " Starting the release ${ version } \n "
git flow release start ${ version }
git flow release start " ${ version } "
# Note: in case the release is already started and the script is started again, checkout the release branch again.
# Note: in case the release is already started and the script is started again, checkout the release branch again.
ret = $?
ret = $?
@ -154,15 +154,15 @@ git commit -a -m "Changelog for version ${version}"
printf "\n================================================================================\n"
printf "\n================================================================================\n"
printf "Creating fastlane file...\n"
printf "Creating fastlane file...\n"
printf -v versionMajor2Digits "%02d" ${ versionMajor }
printf -v versionMajor2Digits "%02d" " ${ versionMajor } "
printf -v versionMinor2Digits "%02d" ${ versionMinor }
printf -v versionMinor2Digits "%02d" " ${ versionMinor } "
printf -v versionPatch2Digits "%02d" ${ versionPatch }
printf -v versionPatch2Digits "%02d" " ${ versionPatch } "
fastlaneFile = " 4 ${ versionMajor2Digits } ${ versionMinor2Digits } ${ versionPatch2Digits } 0.txt "
fastlaneFile = " 4 ${ versionMajor2Digits } ${ versionMinor2Digits } ${ versionPatch2Digits } 0.txt "
fastlanePathFile = " ./fastlane/metadata/android/en-US/changelogs/ ${ fastlaneFile } "
fastlanePathFile = " ./fastlane/metadata/android/en-US/changelogs/ ${ fastlaneFile } "
printf "Main changes in this version: TODO.\nFull changelog: https://github.com/element-hq/element-x-android/releases" > ${ fastlanePathFile }
printf "Main changes in this version: TODO.\nFull changelog: https://github.com/element-hq/element-x-android/releases" > " ${ fastlanePathFile } "
read -p " I have created the file ${ fastlanePathFile } , please edit it and press enter to continue. "
read -p " I have created the file ${ fastlanePathFile } , please edit it and press enter to continue. "
git add ${ fastlanePathFile }
git add " ${ fastlanePathFile } "
git commit -a -m " Adding fastlane file for version ${ version } "
git commit -a -m " Adding fastlane file for version ${ version } "
printf "\n================================================================================\n"
printf "\n================================================================================\n"
@ -173,7 +173,7 @@ printf "\n======================================================================
read -p "Done, push the branch 'main' and the new tag (yes/no) default to yes? " doPush
read -p "Done, push the branch 'main' and the new tag (yes/no) default to yes? " doPush
doPush = ${ doPush :- yes }
doPush = ${ doPush :- yes }
if [ ${ doPush } = = "yes" ] ; then
if [ " ${ doPush } " = = "yes" ] ; then
printf " Pushing branch 'main' and tag 'v ${ version } '...\n "
printf " Pushing branch 'main' and tag 'v ${ version } '...\n "
git push origin main
git push origin main
git push origin " v ${ version } "
git push origin " v ${ version } "
@ -202,7 +202,7 @@ printf "\n======================================================================
read -p "Done, push the branch 'develop' (yes/no) default to yes? (A rebase may be necessary in case develop got new commits) " doPush
read -p "Done, push the branch 'develop' (yes/no) default to yes? (A rebase may be necessary in case develop got new commits) " doPush
doPush = ${ doPush :- yes }
doPush = ${ doPush :- yes }
if [ ${ doPush } = = "yes" ] ; then
if [ " ${ doPush } " = = "yes" ] ; then
printf "Pushing branch 'develop'...\n"
printf "Pushing branch 'develop'...\n"
git push origin develop
git push origin develop
else
else
@ -220,74 +220,74 @@ printf "\n======================================================================
printf "Downloading the artifacts...\n"
printf "Downloading the artifacts...\n"
python3 ./tools/github/download_all_github_artifacts.py \
python3 ./tools/github/download_all_github_artifacts.py \
--token ${ gitHubToken } \
--token " ${ gitHubToken } " \
--runUrl ${ runUrl } \
--runUrl " ${ runUrl } " \
--directory ${ targetPath }
--directory " ${ targetPath } "
printf "\n================================================================================\n"
printf "\n================================================================================\n"
printf "Unzipping the F-Droid artifact...\n"
printf "Unzipping the F-Droid artifact...\n"
fdroidTargetPath = " ${ targetPath } /fdroid "
fdroidTargetPath = " ${ targetPath } /fdroid "
unzip ${ targetPath } /elementx-app-fdroid-apks-unsigned.zip -d ${ fdroidTargetPath }
unzip " ${ targetPath } " /elementx-app-fdroid-apks-unsigned.zip -d " ${ fdroidTargetPath } "
printf "\n================================================================================\n"
printf "\n================================================================================\n"
printf "Signing the FDroid APKs...\n"
printf "Signing the FDroid APKs...\n"
cp ${ fdroidTargetPath } /app-fdroid-arm64-v8a-release.apk \
cp " ${ fdroidTargetPath } " /app-fdroid-arm64-v8a-release.apk \
${ fdroidTargetPath } /app-fdroid-arm64-v8a-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-arm64-v8a-release-signed.apk
${ buildToolsPath } /apksigner sign \
" ${ buildToolsPath } " /apksigner sign \
-v \
-v \
--ks ${ keyStorePath } \
--ks " ${ keyStorePath } " \
--ks-pass pass:${ keyStorePassword } \
--ks-pass pass:" ${ keyStorePassword } " \
--ks-key-alias elementx \
--ks-key-alias elementx \
--key-pass pass:${ keyPassword } \
--key-pass pass:" ${ keyPassword } " \
--min-sdk-version ${ minSdkVersion } \
--min-sdk-version ${ minSdkVersion } \
${ fdroidTargetPath } /app-fdroid-arm64-v8a-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-arm64-v8a-release-signed.apk
cp ${ fdroidTargetPath } /app-fdroid-armeabi-v7a-release.apk \
cp " ${ fdroidTargetPath } " /app-fdroid-armeabi-v7a-release.apk \
${ fdroidTargetPath } /app-fdroid-armeabi-v7a-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-armeabi-v7a-release-signed.apk
${ buildToolsPath } /apksigner sign \
" ${ buildToolsPath } " /apksigner sign \
-v \
-v \
--ks ${ keyStorePath } \
--ks " ${ keyStorePath } " \
--ks-pass pass:${ keyStorePassword } \
--ks-pass pass:" ${ keyStorePassword } " \
--ks-key-alias elementx \
--ks-key-alias elementx \
--key-pass pass:${ keyPassword } \
--key-pass pass:" ${ keyPassword } " \
--min-sdk-version ${ minSdkVersion } \
--min-sdk-version ${ minSdkVersion } \
${ fdroidTargetPath } /app-fdroid-armeabi-v7a-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-armeabi-v7a-release-signed.apk
cp ${ fdroidTargetPath } /app-fdroid-x86-release.apk \
cp " ${ fdroidTargetPath } " /app-fdroid-x86-release.apk \
${ fdroidTargetPath } /app-fdroid-x86-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-x86-release-signed.apk
${ buildToolsPath } /apksigner sign \
" ${ buildToolsPath } " /apksigner sign \
-v \
-v \
--ks ${ keyStorePath } \
--ks " ${ keyStorePath } " \
--ks-pass pass:${ keyStorePassword } \
--ks-pass pass:" ${ keyStorePassword } " \
--ks-key-alias elementx \
--ks-key-alias elementx \
--key-pass pass:${ keyPassword } \
--key-pass pass:" ${ keyPassword } " \
--min-sdk-version ${ minSdkVersion } \
--min-sdk-version ${ minSdkVersion } \
${ fdroidTargetPath } /app-fdroid-x86-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-x86-release-signed.apk
cp ${ fdroidTargetPath } /app-fdroid-x86_64-release.apk \
cp " ${ fdroidTargetPath } " /app-fdroid-x86_64-release.apk \
${ fdroidTargetPath } /app-fdroid-x86_64-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-x86_64-release-signed.apk
${ buildToolsPath } /apksigner sign \
" ${ buildToolsPath } " /apksigner sign \
-v \
-v \
--ks ${ keyStorePath } \
--ks " ${ keyStorePath } " \
--ks-pass pass:${ keyStorePassword } \
--ks-pass pass:" ${ keyStorePassword } " \
--ks-key-alias elementx \
--ks-key-alias elementx \
--key-pass pass:${ keyPassword } \
--key-pass pass:" ${ keyPassword } " \
--min-sdk-version ${ minSdkVersion } \
--min-sdk-version ${ minSdkVersion } \
${ fdroidTargetPath } /app-fdroid-x86_64-release-signed.apk
" ${ fdroidTargetPath } " /app-fdroid-x86_64-release-signed.apk
printf "\n================================================================================\n"
printf "\n================================================================================\n"
printf "Please check the information below:\n"
printf "Please check the information below:\n"
printf "File app-fdroid-arm64-v8a-release-signed.apk:\n"
printf "File app-fdroid-arm64-v8a-release-signed.apk:\n"
${ buildToolsPath } /aapt dump badging ${ fdroidTargetPath } /app-fdroid-arm64-v8a-release-signed.apk | grep package
" ${ buildToolsPath } " /aapt dump badging " ${ fdroidTargetPath } " /app-fdroid-arm64-v8a-release-signed.apk | grep package
printf "File app-fdroid-armeabi-v7a-release-signed.apk:\n"
printf "File app-fdroid-armeabi-v7a-release-signed.apk:\n"
${ buildToolsPath } /aapt dump badging ${ fdroidTargetPath } /app-fdroid-armeabi-v7a-release-signed.apk | grep package
" ${ buildToolsPath } " /aapt dump badging " ${ fdroidTargetPath } " /app-fdroid-armeabi-v7a-release-signed.apk | grep package
printf "File app-fdroid-x86-release-signed.apk:\n"
printf "File app-fdroid-x86-release-signed.apk:\n"
${ buildToolsPath } /aapt dump badging ${ fdroidTargetPath } /app-fdroid-x86-release-signed.apk | grep package
" ${ buildToolsPath } " /aapt dump badging " ${ fdroidTargetPath } " /app-fdroid-x86-release-signed.apk | grep package
printf "File app-fdroid-x86_64-release-signed.apk:\n"
printf "File app-fdroid-x86_64-release-signed.apk:\n"
${ buildToolsPath } /aapt dump badging ${ fdroidTargetPath } /app-fdroid-x86_64-release-signed.apk | grep package
" ${ buildToolsPath } " /aapt dump badging " ${ fdroidTargetPath } " /app-fdroid-x86_64-release-signed.apk | grep package
printf "\n"
printf "\n"
read -p "Does it look correct? Press enter when it's done."
read -p "Does it look correct? Press enter when it's done."
@ -299,7 +299,7 @@ printf "\n======================================================================
printf "Unzipping the Gplay artifact...\n"
printf "Unzipping the Gplay artifact...\n"
gplayTargetPath = " ${ targetPath } /gplay "
gplayTargetPath = " ${ targetPath } /gplay "
unzip ${ targetPath } /elementx-app-gplay-bundle-unsigned.zip -d ${ gplayTargetPath }
unzip " ${ targetPath } " /elementx-app-gplay-bundle-unsigned.zip -d " ${ gplayTargetPath } "
unsignedBundlePath = " ${ gplayTargetPath } /app-gplay-release.aab "
unsignedBundlePath = " ${ gplayTargetPath } /app-gplay-release.aab "
signedBundlePath = " ${ gplayTargetPath } /app-gplay-release-signed.aab "
signedBundlePath = " ${ gplayTargetPath } /app-gplay-release-signed.aab "
@ -307,24 +307,24 @@ signedBundlePath="${gplayTargetPath}/app-gplay-release-signed.aab"
printf "\n================================================================================\n"
printf "\n================================================================================\n"
printf " Signing file ${ unsignedBundlePath } with build-tools version ${ buildToolsVersion } for min SDK version ${ minSdkVersion } ...\n "
printf " Signing file ${ unsignedBundlePath } with build-tools version ${ buildToolsVersion } for min SDK version ${ minSdkVersion } ...\n "
cp ${ unsignedBundlePath } ${ signedBundlePath }
cp " ${ unsignedBundlePath } " " ${ signedBundlePath } "
${ buildToolsPath } /apksigner sign \
" ${ buildToolsPath } " /apksigner sign \
-v \
-v \
--ks ${ keyStorePath } \
--ks " ${ keyStorePath } " \
--ks-pass pass:${ keyStorePassword } \
--ks-pass pass:" ${ keyStorePassword } " \
--ks-key-alias elementx \
--ks-key-alias elementx \
--key-pass pass:${ keyPassword } \
--key-pass pass:" ${ keyPassword } " \
--min-sdk-version ${ minSdkVersion } \
--min-sdk-version ${ minSdkVersion } \
${ signedBundlePath }
" ${ signedBundlePath } "
printf "\n================================================================================\n"
printf "\n================================================================================\n"
printf "Please check the information below:\n"
printf "Please check the information below:\n"
printf "Version code: "
printf "Version code: "
bundletool dump manifest --bundle= ${ signedBundlePath } --xpath= /manifest/@android:versionCode
bundletool dump manifest --bundle= " ${ signedBundlePath } " --xpath= /manifest/@android:versionCode
printf "Version name: "
printf "Version name: "
bundletool dump manifest --bundle= ${ signedBundlePath } --xpath= /manifest/@android:versionName
bundletool dump manifest --bundle= " ${ signedBundlePath } " --xpath= /manifest/@android:versionName
printf "\n"
printf "\n"
read -p "Does it look correct? Press enter to continue. "
read -p "Does it look correct? Press enter to continue. "
@ -336,17 +336,17 @@ printf "\n======================================================================
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
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
doBuildApks = ${ doBuildApks :- yes }
doBuildApks = ${ doBuildApks :- yes }
if [ ${ doBuildApks } = = "yes" ] ; then
if [ " ${ doBuildApks } " = = "yes" ] ; then
printf "Building apks...\n"
printf "Building apks...\n"
bundletool build-apks --bundle= ${ signedBundlePath } --output= ${ gplayTargetPath } /elementx.apks \
bundletool build-apks --bundle= " ${ signedBundlePath } " --output= " ${ gplayTargetPath } " /elementx.apks \
--ks= ./app/signature/debug.keystore --ks-pass= pass:android --ks-key-alias= androiddebugkey --key-pass= pass:android \
--ks= ./app/signature/debug.keystore --ks-pass= pass:android --ks-key-alias= androiddebugkey --key-pass= pass:android \
--overwrite
--overwrite
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
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
doDeploy = ${ doDeploy :- yes }
doDeploy = ${ doDeploy :- yes }
if [ ${ doDeploy } = = "yes" ] ; then
if [ " ${ doDeploy } " = = "yes" ] ; then
printf "Installing apk for your device...\n"
printf "Installing apk for your device...\n"
bundletool install-apks --apks= ${ gplayTargetPath } /elementx.apks
bundletool install-apks --apks= " ${ gplayTargetPath } " /elementx.apks
read -p "Please run the application on your phone to check that the upgrade went well. Press enter to continue. "
read -p "Please run the application on your phone to check that the upgrade went well. Press enter to continue. "
else
else
printf "APK will not be deployed!\n"
printf "APK will not be deployed!\n"
@ -373,7 +373,7 @@ printf "\n======================================================================
body = "%3C%21--%20Copy%20paste%20the%20section%20of%20the%20file%20CHANGES.md%20for%20this%20release%20here%20--%3E"
body = "%3C%21--%20Copy%20paste%20the%20section%20of%20the%20file%20CHANGES.md%20for%20this%20release%20here%20--%3E"
githubCreateReleaseLink = " https://github.com/element-hq/element-x-android/releases/new?tag=v ${ version } &title=Element%20X%20Android%20v ${ version } &body= ${ body } "
githubCreateReleaseLink = " https://github.com/element-hq/element-x-android/releases/new?tag=v ${ version } &title=Element%20X%20Android%20v ${ version } &body= ${ body } "
printf "Creating the release on gitHub.\n"
printf "Creating the release on gitHub.\n"
printf -- "Open this link: %s\n" ${ githubCreateReleaseLink }
printf -- "Open this link: %s\n" " ${ githubCreateReleaseLink } "
printf "Then\n"
printf "Then\n"
printf " - copy paste the section of the file CHANGES.md for this release.\n"
printf " - copy paste the section of the file CHANGES.md for this release.\n"
printf " - click on the 'Generate releases notes' button.\n"
printf " - click on the 'Generate releases notes' button.\n"
@ -392,12 +392,12 @@ if [[ -z "${elementBotToken}" ]]; then
else
else
read -p "Send this message to the room (yes/no) default to yes? " doSend
read -p "Send this message to the room (yes/no) default to yes? " doSend
doSend = ${ doSend :- yes }
doSend = ${ doSend :- yes }
if [ ${ doSend } = = "yes" ] ; then
if [ " ${ doSend } " = = "yes" ] ; then
printf "Sending message...\n"
printf "Sending message...\n"
transactionId = ` openssl rand -hex 16`
transactionId = $( openssl rand -hex 16)
# Element Android internal
# Element Android internal
matrixRoomId = "!LiSLXinTDCsepePiYW:matrix.org"
matrixRoomId = "!LiSLXinTDCsepePiYW:matrix.org"
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 }
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 } "
else
else
printf "Message not sent, please send it manually!\n"
printf "Message not sent, please send it manually!\n"
fi
fi