Merge pull request #10001 from nextcloud/chore/android-app-bundles

Use app bundles for Google Play upload
This commit is contained in:
Tobias Kaminsky 2022-03-22 08:33:50 +01:00 committed by GitHub
commit 6c858840cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 34 deletions

1
.gitignore vendored
View file

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

View file

@ -8,17 +8,17 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.549.0)
aws-sdk-core (3.125.5)
aws-partitions (1.568.0)
aws-sdk-core (3.130.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.53.0)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sdk-kms (1.55.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.111.2)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sdk-s3 (1.113.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.4.0)
@ -36,8 +36,8 @@ GEM
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
emoji_regex (3.2.3)
excon (0.90.0)
faraday (1.9.3)
excon (0.92.1)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.201.1)
fastlane (2.205.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
@ -107,7 +107,7 @@ GEM
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-huawei_appgallery_connect (1.0.18)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.15.0)
google-apis-androidpublisher_v3 (0.16.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-core (0.4.2)
addressable (~> 2.5, >= 2.5.1)
@ -130,7 +130,7 @@ GEM
google-cloud-env (1.5.0)
faraday (>= 0.17.3, < 2.0)
google-cloud-errors (1.2.0)
google-cloud-storage (1.36.0)
google-cloud-storage (1.36.1)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
@ -138,8 +138,8 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.1.0)
faraday (>= 0.17.3, < 2.0)
googleauth (1.1.2)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
@ -149,7 +149,7 @@ GEM
http-cookie (1.0.4)
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.5.0)
jmespath (1.6.1)
json (2.6.1)
jwt (2.3.0)
memoist (0.16.2)
@ -174,9 +174,9 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.16.0)
signet (0.16.1)
addressable (~> 2.8)
faraday (>= 0.17.3, < 2.0)
faraday (>= 0.17.5, < 3.0)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.8)
@ -193,7 +193,7 @@ GEM
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unf_ext (0.0.8.1)
unicode-display_width (1.8.0)
webrick (1.7.0)
word_wrap (1.0.0)

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
@ -278,12 +278,12 @@ private_lane :enableLogger do
sh("sed -i s'#<bool name=\"logger_enabled\">true</bool>#<bool name=\"logger_enabled\">false</bool>#' ../app/src/main/res/values/setup.xml")
end
desc "Upload to play store"
desc "Upload to play store (beta)"
private_lane :uploadToPlaystore_RC do |options|
upload_to_play_store(
skip_upload_images: true,
track: 'beta',
apk: "release/gplay-release-" + options["versionCode"] + ".apk"
aab: "release/app-gplay-release.aab"
)
end
@ -291,10 +291,39 @@ desc "Upload to play store"
private_lane :uploadToPlaystore_Final do |options|
upload_to_play_store(
skip_upload_images: true,
apk: "release/gplay-release-" + options["versionCode"] + ".apk"
aab: "release/app-gplay-release.aab"
)
end
desc "Build app bundle"
private_lane :buildBundle do |options|
gradle(
task: 'bundle',
flavor: options[:flavor],
build_type: 'Release',
print_command: false,
properties: {
"android.injected.signing.store.file" => ENV["FASTLANE_NEXTCLOUD_UPLOAD_STORE_FILE"],
"android.injected.signing.store.password" => ENV["FASTLANE_NEXTCLOUD_UPLOAD_STORE_PASSWORD"],
"android.injected.signing.key.alias" => ENV["FASTLANE_NEXTCLOUD_UPLOAD_KEY_ALIAS"],
"android.injected.signing.key.password" => ENV["FASTLANE_NEXTCLOUD_UPLOAD_KEY_PASSWORD"],
}
)
end
desc "Generate 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 "Build signed APK"
private_lane :SignedRelease do |options|
gradle(
task: 'assemble',