class Fastlane::Actions::EncryptFastlaneVarsAction

Constants

ANDROID_ENV_PATH
FASTLANE_CRYPTEX_KEY
IOS_ENV_PATH

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/encrypt_fastlane_vars.rb, line 56
def self.authors
  ["cball", "isaiahgrey93", "cmejet"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/encrypt_fastlane_vars.rb, line 44
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :skip_confirmation,
                                 env_name: "FL_ENCRYPT_APP_VARS_SKIP_CONFIRMATION", # The name of the environment variable
                                 description: "Allows commands to be run from within CLI and skip the UI.message confirmation dialog", # a short description of this parameter
                                 type: Boolean,
                                 short_option:'s',
                                 default_value: false,
                                 optional: true),
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/encrypt_fastlane_vars.rb, line 40
def self.description
  "Encrypt fastlane vars for CI"
end
details() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/encrypt_fastlane_vars.rb, line 64
def self.details
  "Saves the current vars in android/fastlane/.env and ios/fastlane/.env"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/encrypt_fastlane_vars.rb, line 68
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  [:ios, :android].include?(platform)
end
return_value() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/encrypt_fastlane_vars.rb, line 60
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/encrypt_fastlane_vars.rb, line 11
def self.run(params)
  skip_confirmation= params[:skip_confirmation]

  if !File.exists?(IOS_ENV_PATH)
    UI.user_error!("No .env found in ios directory!")
  end

  if !File.exists?(ANDROID_ENV_PATH)
    UI.user_error!("No .env found in Android directory")
  end


  if !skip_confirmation && !UI.confirm("This will save values from your #{IOS_ENV_PATH} and #{ANDROID_ENV_PATH} to the encrypted context repo. Proceed?")
    UI.abort_with_message!("Stepping away...")
  end

  android_env_vars = Dotenv.parse(ANDROID_ENV_PATH)
  ios_env_vars = Dotenv.parse(IOS_ENV_PATH)
  vars = android_env_vars.merge(ios_env_vars)
    
  other_action.cryptex(
    type: "import_env",
    key: FASTLANE_CRYPTEX_KEY,
    hash: vars,
  )

  UI.success "ENV vars set in context repo."
end