class Fastlane::Actions::GenerateAndroidKeystoreAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/generate_android_keystore.rb, line 89 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: Helper::ReactNativeReleaseHelper::ANDROID_KEYSTORE_PATH), 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/generate_android_keystore.rb, line 49 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/generate_android_keystore.rb, line 80 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/generate_android_keystore.rb, line 84 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/generate_android_keystore.rb, line 66 def self.encrypt_keystore(keystore_path) key = Helper::ReactNativeReleaseHelper::ANDROID_KEYSTORE_CRYPTEX_KEY other_action.cryptex( type: "import", in: keystore_path, key: key ) end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/generate_android_keystore.rb, line 132 def self.is_supported?(platform) [:ios, :android].include?(platform) end
return_value()
click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/generate_android_keystore.rb, line 119 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/generate_android_keystore.rb, line 7 def self.run(params) encrypt_in_repo = params[:encrypt_in_repo] key = Helper::ReactNativeReleaseHelper::ANDROID_KEYSTORE_CRYPTEX_KEY # Confirm if there is an existing key in the repo... we don't want to overwrite prod! begin existing_remote_key = other_action.cryptex( type: "export", key: key ) # If we don't have a keystore, cryptex will throw an exception. rescue => ex # create a new keystore and encrypt it UI.message('no keystore found in repo. creating it.') keystore = create_keystore_with_params(params) message = 'Created keystore' if encrypt_in_repo encrypt_keystore(keystore) message.concat(' and saved to repo.') end UI.success(message) end # If encrypting, confirm remote overwrite if (encrypt_in_repo && UI.confirm("This will overwrite your existing keystore! Are you sure?")) keystore_path = create_keystore_with_params(params) encrypt_keystore(keystore_path) UI.success('Created keystore and saved to repo.') elsif encrypt_in_repo # The user does not want to proceed UI.abort_with_message!("Stepping away...") else # Create, but don't encrypt create_keystore_with_params(params) UI.success('Created keystore, but did not save it to the repo.') end end