fastlane: Build AAB for gplayRelease in addition to APK

APK is generated from AAB using bundletool, for speed and to ensure contents are the same

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2022-03-21 15:25:36 +01:00
parent 380585ea52
commit ae0840e5aa
No known key found for this signature in database
GPG key ID: 2585783189A62105
2 changed files with 37 additions and 14 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
# built application files
*.apk
*.ap_
*.aab
# files for the dex VM
*.dex

View file

@ -86,41 +86,40 @@ end
desc "Makes gplay and generic releases in ../releases/"
lane :makeReleases do
info = androidVersion
sh("mkdir -p ../release")
sh("rm -rf ../release/*")
sh("rm -rf ../app/build")
sh("rm -rf ../release/ && mkdir -p ../release")
gradle(task: 'clean')
SignedRelease(flavor:"Generic")
sh("mv ../app/build/outputs/apk/generic/release/*.apk ../release/")
sh("mv ../release/generic-release-#{info["versionCode"]}.apk ../release/nextcloud-#{info["versionCode"]}.apk")
createGenericRelease(versionCode:info["versionCode"])
SignedRelease(flavor:"Gplay")
sh("cp ../app/build/outputs/apk/gplay/release/*.apk ../release/")
createGplayRelease(versionCode:info["versionCode"])
SignedRelease(flavor:"Huawei")
sh("cp ../app/build/outputs/apk/huawei/release/*.apk ../release/")
createHuaweiRelease()
end
desc "Create GPlay release"
lane :createGplayRelease do |options|
SignedRelease(flavor:"Gplay")
sh("mv ../app/build/outputs/apk/gplay/release/*.apk ../release/")
buildBundle(flavor:"Gplay")
sh("mv ../app/build/outputs/bundle/gplayRelease/app-gplay-release.aab ../release/")
buildApkFromBundle(outputDir: "../release", bundlePath: "../release/app-gplay-release.aab")
sh("rm ../release/toc.pb")
sh("mv ../release/universal.apk ../release/gplay-release-#{options[:versionCode]}.apk")
end
desc "Create Generic release"
lane :createGenericRelease do |options|
SignedRelease(flavor:"Generic")
sh("mv ../app/build/outputs/apk/generic/release/*.apk ../release/")
sh("mv ../release/generic-release-#{options[:versionCode]}.apk ../release/nextcloud-#{options[:versionCode]}.apk")
end
desc "Create Huawei release"
lane :createHuaweiRelease do |options|
lane :createHuaweiRelease do
SignedRelease(flavor:"Huawei")
sh("mv ../app/build/outputs/apk/huawei/release/*.apk ../release/")
end
desc "Create Dev release"
lane :createDevRelease do |options|
lane :createDevRelease do
SignedRelease(flavor:"VersionDev")
sh("mv ../app/build/outputs/apk/versionDev/release/*.apk ../release/")
end
@ -168,6 +167,7 @@ end
private_lane :checkReleaseRequirements_common do
sh("if ! command -v fdroid &>/dev/null; then echo 'fdroid command not found' && exit 1; fi")
sh("if ! command -v bundletool &>/dev/null; then echo 'bundletool command not found' && exit 1; fi")
end
private_lane :checkReleaseRequirements_RC do
@ -295,6 +295,28 @@ private_lane :uploadToPlaystore_Final do |options|
)
end
desc "Builds app bundle"
private_lane :buildBundle do |options|
gradle(
task: 'bundle',
flavor: options[:flavor],
build_type: 'Release'
)
end
desc "Generates signed universal APK from app bundle"
private_lane :buildApkFromBundle do |options|
sh(command:"bundletool build-apks --mode universal --output '#{options[:outputDir]}' --output-format DIRECTORY" +
" --ks '#{ENV["FASTLANE_NEXTCLOUD_STORE_FILE"]}'"+
" --ks-pass 'pass:#{ENV["FASTLANE_NEXTCLOUD_STORE_PASSWORD"]}'"+
" --ks-key-alias '#{ENV["FASTLANE_NEXTCLOUD_KEY_ALIAS"]}'"+
" --key-pass 'pass:#{ENV["FASTLANE_NEXTCLOUD_KEY_PASSWORD"]}'"+
" --bundle '#{options[:bundlePath]}'",
log:false)
end
desc "Builds signed APK"
private_lane :SignedRelease do |options|
gradle(
task: 'assemble',