[Android] Require sha256 files for FTP + better file checks for all lanes
Nicolas Pomepuy
git at videolan.org
Mon Oct 5 19:00:12 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Oct 5 15:33:16 2020 +0200| [61591c48a346bbb0d6fc0d70820e1215a634a104] | committer: Nicolas Pomepuy
Require sha256 files for FTP + better file checks for all lanes
> https://code.videolan.org/videolan/vlc-android/commit/61591c48a346bbb0d6fc0d70820e1215a634a104
---
buildsystem/automation/README.md | 2 +-
buildsystem/automation/fastlane/Fastfile | 102 +++++++++++++++++++------------
2 files changed, 63 insertions(+), 41 deletions(-)
diff --git a/buildsystem/automation/README.md b/buildsystem/automation/README.md
index 9415f0652..6daa2f2c9 100644
--- a/buildsystem/automation/README.md
+++ b/buildsystem/automation/README.md
@@ -77,7 +77,7 @@ You need to export 1 env variable: VIDEOLAN_FTP_HOST
Options: `version` is the version string in the apk name.
-The 4 apks will be uploaded in the `/incoming/[version]` folder of the FTP with anonymous credentials
+The 4 apks and the 4 `.sha256` files will be uploaded in the `/incoming/[version]` folder of the FTP with anonymous credentials
### Screenshots
diff --git a/buildsystem/automation/fastlane/Fastfile b/buildsystem/automation/fastlane/Fastfile
index 89c473926..eeb03be59 100644
--- a/buildsystem/automation/fastlane/Fastfile
+++ b/buildsystem/automation/fastlane/Fastfile
@@ -16,6 +16,39 @@
default_platform(:android)
platform :android do
+
+ @variants = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
+
+ def checkAPKFileExists(version, checkSha)
+ allExist = true
+ @variants.each { |variant|
+ file_name = "VLC-Android-"+version+"-"+variant+".apk"
+ # checking apks
+ if (!File.file?("../"+file_name))
+ allExist = false
+ UI.error "File "+file_name+" doesn't exist"
+ end
+ if checkSha
+ # checking sha256
+ if (!File.file?("../"+file_name+".sha256"))
+ allExist = false
+ UI.error "File "+file_name+".sha256 doesn't exist"
+ end
+ end
+ }
+ if !allExist
+ UI.user_error!("Missing files to upload. See above")
+ end
+ end
+
+ def getFileList(version)
+ files = Array.new
+ @variants.each { |variant|
+ files.push("VLC-Android-"+version+"-"+variant+".apk")
+ }
+ return files
+ end
+
desc "Runs all the tests"
lane :test do
gradle(task: "test")
@@ -23,7 +56,8 @@ platform :android do
desc "Deploy a new version to the Google Play"
lane :deploy_release do |options|
- upload_to_play_store(skip_upload_changelogs:true, skip_upload_images:true, skip_upload_screenshots:true, release_status:"draft", apk_paths:["VLC-Android-"+options[:version]+"-arm64-v8a.apk", "VLC-Android-"+options[:version]+"-armeabi-v7a.apk", "VLC-Android-"+options[:version]+"-x86.apk", "VLC-Android-"+options[:version]+"-x86_64.apk"])
+ checkAPKFileExists options[:version], false
+ upload_to_play_store(skip_upload_changelogs:true, skip_upload_images:true, skip_upload_screenshots:true, release_status:"draft", apk_paths:getFileList(options[:version]))
slack(message: 'Successfully created a new draft for '+options[:version])
end
@@ -33,7 +67,8 @@ platform :android do
end
lane :deploy_beta do |options|
- upload_to_play_store(skip_upload_changelogs:true, track: 'beta', skip_upload_images:true, skip_upload_screenshots:true, skip_upload_apk:false, release_status:"draft", apk_paths:["VLC-Android-"+options[:version]+"-arm64-v8a.apk", "VLC-Android-"+options[:version]+"-armeabi-v7a.apk", "VLC-Android-"+options[:version]+"-x86.apk", "VLC-Android-"+options[:version]+"-x86_64.apk"])
+ checkAPKFileExists options[:version], false
+ upload_to_play_store(skip_upload_changelogs:true, track: 'beta', skip_upload_images:true, skip_upload_screenshots:true, skip_upload_apk:false, release_status:"draft", apk_paths:getFileList(options[:version]))
slack(message: 'Successfully created a new beta draft for '+options[:version])
end
@@ -70,7 +105,6 @@ platform :android do
end
lane :deploy_huawei do |options|
- #gradle(task: 'assemble', build_type: 'Release')
huawei_appgallery_connect(
client_id: ENV["HUAWEI_CLIENT_ID"],
client_secret: ENV["HUAWEI_CLIENT_SECRET"],
@@ -82,43 +116,31 @@ platform :android do
end
lane :deploy_ftp do |options|
- #gradle(task: 'assemble', build_type: 'Release')
- ftp(
- host: ENV["VIDEOLAN_FTP_HOST"],
- username: 'anonymous',
- password: '',
- upload:{
- src: "./VLC-Android-"+options[:version]+"-arm64-v8a.apk",
- dest: "/incoming/"+options[:version]
- }
- )
- ftp(
- host: ENV["VIDEOLAN_FTP_HOST"],
- username: 'anonymous',
- password: '',
- upload:{
- src: "./VLC-Android-"+options[:version]+"-armeabi-v7a.apk",
- dest: "/incoming/"+options[:version]
- }
- )
- ftp(
- host: ENV["VIDEOLAN_FTP_HOST"],
- username: 'anonymous',
- password: '',
- upload:{
- src: "./VLC-Android-"+options[:version]+"-x86.apk",
- dest: "/incoming/"+options[:version]
- }
- )
- ftp(
- host: ENV["VIDEOLAN_FTP_HOST"],
- username: 'anonymous',
- password: '',
- upload:{
- src: "./VLC-Android-"+options[:version]+"-x86_64.apk",
- dest: "/incoming/"+options[:version]
- }
- )
+
+ checkAPKFileExists options[:version]
+
+ puts "All files are here. Uploading to FTP"
+ @variants.each { |variant|
+ ftp(
+ host: ENV["VIDEOLAN_FTP_HOST"],
+ username: 'anonymous',
+ password: '',
+ upload:{
+ src: "./VLC-Android-"+options[:version]+"-"+variant+".apk",
+ dest: "/incoming/"+options[:version]
+ }
+ )
+ ftp(
+ host: ENV["VIDEOLAN_FTP_HOST"],
+ username: 'anonymous',
+ password: '',
+ upload:{
+ src: "./VLC-Android-"+options[:version]+"-"+variant+".apk.sha256",
+ dest: "/incoming/"+options[:version]
+ }
+ )
+ }
+
slack(message: 'Successfully uploaded '+options[:version]+' to FTP')
end
More information about the Android
mailing list