Class: Fastlane::Actions::GenerateAndroidKeystoreAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GenerateAndroidKeystoreAction
- Defined in:
- lib/fastlane/plugin/react_native_release/actions/generate_android_keystore.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
Class Method Summary collapse
-
.create_keystore_with_params(params) ⇒ Object
Creates a new android keystore based on the provided params.
-
.encrypt_keystore(keystore_path) ⇒ Object
Saves a keystore to the repo.
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
127 128 129 130 |
# File 'lib/fastlane/plugin/react_native_release/actions/generate_android_keystore.rb', line 127 def self. # So no one will ever forget your contribution to fastlane :) You are awesome btw! ["cball", "isaiahgrey93"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/react_native_release/actions/generate_android_keystore.rb', line 89 def self. [ 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) ⇒ Object
Creates a new android keystore based on the provided params. Wraps Cryptex.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# 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.("Could not create keystore. Do you already have one with this alias?") end params[:destination] end |
.description ⇒ Object
80 81 82 |
# 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 ⇒ Object
84 85 86 87 |
# 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) ⇒ Object
Saves a keystore to the repo. Note this will overwrite it!
66 67 68 69 70 71 72 73 74 |
# 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) ⇒ Boolean
132 133 134 |
# 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 ⇒ Object
119 120 121 |
# 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) ⇒ Object
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 |
# 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.('no keystore found in repo. creating it.') keystore = create_keystore_with_params(params) = 'Created keystore' if encrypt_in_repo encrypt_keystore(keystore) .concat(' and saved to repo.') end UI.success() 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.("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 |