class Fastlane::Actions::DecryptAndroidKeystoreAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 83 def self.available_options [ FastlaneCore::ConfigItem.new(key: :encrypt_in_repo, env_name: "FL_GENERATE_ANDROID_KEYSTORE_ENCRYPT_IN_REPO", description: "If the new keystore should be encrypted and saved", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :password, env_name: "FL_GENERATE_ANDROID_KEYSTORE_PASSWORD", description: "Password for the Keystore", type: String), FastlaneCore::ConfigItem.new(key: :alias, env_name: "FL_GENERATE_ANDROID_KEYSTORE_ALIAS", description: "ALIAS for the Keystore", type: String), FastlaneCore::ConfigItem.new(key: :destination, env_name: "FL_GENERATE_ANDROID_KEYSTORE_DESTINATION", description: "Where to put decrypted keystore", default_value: "../android/app/android.keystore"), FastlaneCore::ConfigItem.new(key: :fullname, env_name: "FL_GENERATE_ANDROID_KEYSTORE_FULLNAME", description: "Fullname of keystore owner", type: String), FastlaneCore::ConfigItem.new(key: :city, env_name: "FL_GENERATE_ANDROID_KEYSTORE_CITY", description: "City of keystore owner", type: String), ] end
create_keystore_with_params(params)
click to toggle source
Creates a new android keystore based on the provided params. Wraps Cryptex.
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 43 def self.create_keystore_with_params(params) begin other_action.cryptex_generate_keystore( destination: params[:destination], password: params[:password], fullname: params[:fullname], city: params[:city], alias: params[:alias] ) rescue => ex UI.abort_with_message!("Could not create keystore. Do you already have one with this alias?") end params[:destination] end
description()
click to toggle source
@!group Documentation
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 74 def self.description "Decrypts app env vars and sets the values in the root .env file" end
details()
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 78 def self.details # Optional: # this is your chance to provide a more detailed description of this action end
encrypt_keystore(keystore_path)
click to toggle source
Saves a keystore to the repo. Note this will overwrite it!
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 60 def self.encrypt_keystore(keystore_path) key = Helper::ReactNativeReleaseHelper::ANDROID_KEYSTORE_CRYPTEX_KEY other_action.cryptex( type: "import", in: keystore_path, key: key ) end
export_and_decrypt_keystore(file,key)
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 30 def self.export_and_decrypt_keystore(file,key) other_action.cryptex( type: "export", out: file, key: key, verbose: true ) # There is currently a bug where the keystore needs to be in multiple paths # Optimized for the CI process to be running from the lane in android directory sh("cp ./app/android.keystore ./") end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 126 def self.is_supported?(platform) [:ios, :android].include?(platform) end
return_value()
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 113 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_android_keystore.rb, line 7 def self.run(params) key = Helper::ReactNativeReleaseHelper::ANDROID_KEYSTORE_CRYPTEX_KEY file = Helper::ReactNativeReleaseHelper::ANDROID_KEYSTORE_PATH begin env_file_exists = File.exists?(file) if (env_file_exists && UI.confirm("This will overwrite your existing .env file. Proceed?")) self.export_and_decrypt_keystore(file,key) elsif(env_file_exists) UI.abort_with_message!("Stepping away...") else self.export_and_decrypt_keystore(file,key) end # If we don't have a keystore, cryptex will throw an exception. rescue => ex UI.abort_with_message!('Error decrypting keystore. Does it exist in the repo?') end UI.success("Decrypted #{key} to keystore.") end