Class: Fastlane::Actions::FivSignAndroidAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



111
112
113
114
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 111

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["Your GitHub/Twitter Name"]
end

.available_optionsObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 54

def self.available_options
  # Define all options your action supports. 
  
  # Below a few examples
  [
    FastlaneCore::ConfigItem.new(key: :output_directory,
      env_name: "ANDROID_KEYSTORE_OUTPUT_DIRECTORY",
      description: "",
      is_string: true,
      optional: false,
      default_value: File.absolute_path(File.join(Dir.pwd, ".android_signing"))),
FastlaneCore::ConfigItem.new(key: :keystore_name,
      env_name: "ANDROID_KEYSTORE_KEYSTORE_NAME",
      description: "",
      is_string: true,
      optional: false),
FastlaneCore::ConfigItem.new(key: :alias,
      env_name: "ANDROID_KEYSTORE_KEYSTORE_ALIAS",
      description: "",
      is_string: true,
      optional: false),
    FastlaneCore::ConfigItem.new(
      key: :version,
      env_name: "CURRENT_BUILD_VERSION",
      description: "current build version from config.xml",
      is_string: true,
      default_value: ''
    ),
    FastlaneCore::ConfigItem.new(
      key: :build_no,
      env_name: "CURRENT_BUILD_NUMBER",
      description: "current build number from config.xml",
      is_string: true,
      default_value: ''
    ),
    FastlaneCore::ConfigItem.new(
      key: :silent,
      env_name: "SIGN_ANDROID_SLIENT",
      description: "wether to sign android silently",
      is_string: false,
      default_value: true
    )
  ]
end

.descriptionObject



40
41
42
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 40

def self.description
  "A short description with <= 80 characters of what this action does"
end

.detailsObject



48
49
50
51
52
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 48

def self.details
  # Optional:
  # this is your chance to provide a more detailed description of this action
  "You can use this action to do cool things..."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 116

def self.is_supported?(platform)
 platform == :android
end

.outputObject



99
100
101
102
103
104
105
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 99

def self.output
  # Define the shared values you are going to provide
  # Example
  [
    ['FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE', 'A description of what this value contains']
  ]
end

.return_valueObject



107
108
109
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 107

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



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
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 9

def self.run(params)

 
  keystore_path = Fastlane::Actions::FivAndroidKeystoreAction.run(params)

  keychain_entry = CredentialsManager::AccountManager.new(user: "#{params[:keystore_name]}_android_keystore_storepass")
  keystore_storepass = keychain_entry.password

  keychain_entry = CredentialsManager::AccountManager.new(user: "#{params[:keystore_name]}_android_keystore_keypass")
  keystore_keypass = keychain_entry.password

  puts "Silent execution of jarsigner because we don't want to print passwords. You can delete the password if they are wrong stored in the keychain: 'fastlane fastlane-credentials remove --username android_keystore_storepass' and 'fastlane fastlane-credentials remove --username android_keystore_keypass'"
  sign = "jarsigner -tsa http://timestamp.digicert.com -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore #{keystore_path} -storepass #{keystore_storepass} -keypass #{keystore_keypass} ./platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk fivethree"
  path = "./platforms/android/app/build/outputs/apk/release/app-release-#{params[:version]}-#{params[:build_no]}.apk"
  zipalign = "$ANDROID_SDK/build-tools/$ANDROID_BUILD_TOOL_VERSION/zipalign -v 4 \"./platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk\" \"#{path}\""
  if params[:silent]
    self.run_silent(sign)
    self.run_silent(zipalign)
  else
    sh sign
    sh zipalign
  end

  return path

end

.run_silent(command) ⇒ Object



43
44
45
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_sign_android.rb', line 43

def self.run_silent(command)
  Fastlane::Actions::sh(command, log: false)
end