class Fastlane::Actions::DecryptFastlaneVarsAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_fastlane_vars.rb, line 91
def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["cball", "isaiahgrey93"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_fastlane_vars.rb, line 65
def self.available_options
  # Define all options your action supports.
  
  # Below a few examples
  [
    FastlaneCore::ConfigItem.new(key: :set_env,
                                 env_name: "FL_DECRYPT_FASTLANE_VARS_SET_ENV", # The name of the environment variable
                                 description: "Sets the decrypted values in env", # a short description of this parameter
                                 type: Boolean,
                                 default_value: true),
    FastlaneCore::ConfigItem.new(key: :write_env,
                                 env_name: "FL_DECRYPT_FASTLANE_VARS_WRITE_ENV", # The name of the environment variable
                                 description: "If we should write fastlane .env files", # a short description of this parameter
                                 type: Boolean,
                                 default_value: true)
  ]
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/react_native_release/actions/decrypt_fastlane_vars.rb, line 56
def self.description
  "Decrypts fastlane ENV vars from the encrypted repo. Optionally sets them in ENV."
end
details() click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_fastlane_vars.rb, line 60
def self.details
  # Optional:
  # this is your chance to provide a more detailed description of this action
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/react_native_release/actions/decrypt_fastlane_vars.rb, line 96
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_fastlane_vars.rb, line 83
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_fastlane_vars.rb, line 7
def self.run(params)

  is_ci = ENV['CI'] === 'true'
  write_env = params[:write_env]

  env = other_action.cryptex(
    type: "export_env",
    key: Helper::ReactNativeReleaseHelper::FASTLANE_CRYPTEX_KEY,
    set_env: params[:set_env]
  )

  should_write_env = write_env && !is_ci


  UI.success('Successfully decrypted fastlane vars.')

  # write fastlane env files
  if (should_write_env)

    UI.success('Writing fastlane vars to <root>/fastlane/.env.')
    
    open('./fastlane/.env', 'w') do |f|
      env.each {|key, value| f.puts "#{key}=#{value}" }
    end
 
    UI.success('Writing fastlane vars to <root>/ios/fastlane/.env.')
    
    open('./ios/fastlane/.env', 'w') do |f|
      env.each {|key, value| f.puts "#{key}=#{value}" }
    end
 
    UI.success('Writing fastlane vars to <root>/android/fastlane/.env.')
    
    open('./android/fastlane/.env', 'w') do |f|
      env.each {|key, value| f.puts "#{key}=#{value}" }
    end

    UI.success('Fastlane .env files were successfully written.')
  else
    UI.success('Fastlane .env not generated.')
  end

  env
end