Class: Fastlane::Actions::FivSignAndroidAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FivSignAndroidAction
- Defined in:
- lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run_shell_script(command, silent) ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
139 140 141 142 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 139 def self. # So no one will ever forget your contribution to fastlane :) You are awesome btw! ["marcjulian"] end |
.available_options ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 62 def self. # Define all options your action supports. # Below a few examples [ FastlaneCore::ConfigItem.new( key: :keystore_path, env_name: "FIV_KEYSTORE_PATH", description: "Path to android keystore", is_string: true, default_value: "./fastlane/android"), FastlaneCore::ConfigItem.new( key: :keystore_name, env_name: "FIV_KEYSTORE_NAME", description: "Name of the keystore", is_string: true, optional: false), FastlaneCore::ConfigItem.new( key: :android_sdk_path, env_name: "FIV_ANDROID_SDK_PATH", description: "Path to your installed Android SDK", is_string: true, default_value: "~/Library/Android/sdk"), FastlaneCore::ConfigItem.new( key: :android_build_tool_version, env_name: "FIV_ANDROID_SDK_BUILD_TOOL_VERSION", description: "Android Build Tool version used for `zipalign`, `sign` and `verify`", is_string: true, default_value: "28.0.3"), FastlaneCore::ConfigItem.new( key: :apk_output_dir, env_name: "FIV_APK_OUTPUT_DIR", description: "Output path of the signed apk", is_string: true, default_value: "../platforms/android/app/build/outputs/apk/release"), FastlaneCore::ConfigItem.new( key: :key_alias, env_name: "FIV_ANDROID_KEYSTORE_ALIAS", description: "Key alias of the keystore", is_string: true, optional: false), FastlaneCore::ConfigItem.new( key: :app_version, env_name: "FIV_APP_VERSION", description: "App version", is_string: true, default_value: '' ), FastlaneCore::ConfigItem.new( key: :app_build_no, env_name: "FIV_APP_BUILD_NO", description: "App build number", is_string: true, default_value: '' ), FastlaneCore::ConfigItem.new( key: :silent, env_name: "FIV_SIGN_ANDROID_SILENT", description: "Wether to sign android silently", is_string: false, default_value: true ) ] end |
.description ⇒ Object
48 49 50 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 48 def self.description "Zipalign, sign and verify android apk" end |
.details ⇒ Object
56 57 58 59 60 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 56 def self.details # Optional: # this is your chance to provide a more detailed description of this action "You can use this action to do cool things..." end |
.is_supported?(platform) ⇒ Boolean
144 145 146 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 144 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 127 def self.output # Define the shared values you are going to provide # Example [ ['FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE', 'A description of what this value contains'] ] end |
.return_value ⇒ Object
135 136 137 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 135 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 4 def self.run(params) keystore_path = Fastlane::Actions::FivAndroidKeystoreAction.run(params) keychain_entry = CredentialsManager::AccountManager.new(user: "#{params[:keystore_name]}_android_keystore_storepass") keystore_storepass = keychain_entry.password keychain_entry = CredentialsManager::AccountManager.new(user: "#{params[:keystore_name]}_android_keystore_keypass") keystore_keypass = keychain_entry.password puts "You can delete the password if they are wrong stored in the keychain: 'fastlane fastlane-credentials remove --username android_keystore_storepass' and 'fastlane fastlane-credentials remove --username android_keystore_keypass'" android_build_tool_path = "#{params[:android_sdk_path]}/build-tools/#{params[:android_build_tool_version]}" # zipalign APK remove_zipalign = "rm -Rf ../platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk" sh remove_zipalign zipalign = "#{android_build_tool_path}/zipalign -v 4 \ ../platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk \ ../platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk" sh zipalign if(!File.directory?(params[:apk_output_dir])) Dir.mkdir params[:apk_output_dir] end output_path = "#{params[:apk_output_dir]}/app-release-#{params[:app_version]}-#{params[:app_build_no]}.apk" sign = "#{android_build_tool_path}/apksigner sign \ --ks #{keystore_path} \ --ks-key-alias #{params[:key_alias]} \ --ks-pass pass:#{keystore_keypass} \ --out #{output_path} \ ../platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk" self.run_shell_script(sign, params[:silent]) verify = ("#{android_build_tool_path}/apksigner verify -v #{output_path}") self.run_shell_script(verify, params[:silent]) return output_path end |
.run_shell_script(command, silent) ⇒ Object
52 53 54 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 52 def self.run_shell_script(command, silent) Fastlane::Actions::sh(command, log: silent) end |