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) ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
186 187 188 189 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 186 def self. # So no one will ever forget your contribution to fastlane :) You are awesome btw! %w[marcjulian] end |
.available_options ⇒ Object
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 90 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_source, env_name: 'FIV_APK_SOURCE', description: 'Source path to the apk file', is_string: true, default_value: './platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk' ), FastlaneCore::ConfigItem.new( key: :apk_zipalign_target, env_name: 'FIV_APK_ZIPALIGN_TARGET', description: 'Target path for the zipaligned apk', is_string: true, default_value: './platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk' ), FastlaneCore::ConfigItem.new( key: :apk_signed_target, env_name: 'FIV_APK_SIGNED_TARGET', description: 'Tarket 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: '' ) ] end |
.description ⇒ Object
76 77 78 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 76 def self.description 'Zipalign, sign and verify android apk' end |
.details ⇒ Object
84 85 86 87 88 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 84 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
191 192 193 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 191 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
171 172 173 174 175 176 177 178 179 180 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 171 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
182 183 184 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 182 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# 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_file = params[:apk_zipalign_target] if (File.file?(zipalign_apk_file)) remove_zipalign = "rm -Rf #{zipalign_apk_file}" sh remove_zipalign end # zipalign APK zipalign = "#{android_build_tool_path}/zipalign -v 4 \ #{ params[:apk_source] } \ #{zipalign_apk_file}" sh zipalign if (!File.directory?(params[:apk_signed_target])) Dir.mkdir params[:apk_signed_target] end output_path = "#{params[:apk_signed_target]}/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 } \ #{zipalign_apk_file}" self.run_shell_script(sign) verify = ("#{android_build_tool_path}/apksigner verify -v #{output_path}") self.run_shell_script(verify) return output_path end |
.run_shell_script(command) ⇒ Object
80 81 82 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 80 def self.run_shell_script(command) Fastlane::Actions.sh(command) end |