fastlane-plugin-match_keystore 0.1.13 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a109e0eb2a91578a04778376e7a615618e06a85e4b62f303bb05e02b17475d82
|
4
|
+
data.tar.gz: 1d1c7e90bded78f03eb4056e5a1789f06de6e47fa8b1c0d53eb70e2f5a7c224a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da211c6429b73a41c3f997215902de7329d397e8976e42bbb79c4a61663bf4843ea1872e3a9756bb112039c7d11e0f42ec9f3d2346f7c4e0071fe0f190d92a4
|
7
|
+
data.tar.gz: 1c6abba20d95cd5b01659fd787c6e0fbbb718fc62cb4785781c3710bc6289933f6454fc54d67bd03c5dae4e47c03690b94992713c1ca18cdd0a2a4c52d975e84
|
data/README.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/fastlane-plugin-match_keystore)
|
4
4
|
|
5
|
+
## Machine requirements
|
6
|
+
|
7
|
+
* OpenSSL 1.1.1 min OR LibreSSL 2.9 min installed
|
8
|
+
* Git installed
|
9
|
+
* Android SDK & Build-tools installed
|
10
|
+
* ANDROID_HOME environment variable defined
|
11
|
+
|
5
12
|
## Getting Started
|
6
13
|
|
7
14
|
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-match_keystore`, add it to your project by running:
|
@@ -2,6 +2,7 @@ require 'fastlane/action'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'os'
|
4
4
|
require 'json'
|
5
|
+
require 'pry'
|
5
6
|
require 'digest'
|
6
7
|
require_relative '../helper/match_keystore_helper'
|
7
8
|
|
@@ -15,11 +16,21 @@ module Fastlane
|
|
15
16
|
|
16
17
|
class MatchKeystoreAction < Action
|
17
18
|
|
19
|
+
def self.openssl_path
|
20
|
+
path = "/usr/local/opt/openssl@1.1/bin"
|
21
|
+
path
|
22
|
+
end
|
23
|
+
|
18
24
|
def self.to_md5(value)
|
19
25
|
hash_value = Digest::MD5.hexdigest value
|
20
26
|
hash_value
|
21
27
|
end
|
22
28
|
|
29
|
+
def self.sha512(value)
|
30
|
+
hash_value = Digest::SHA512.hexdigest value
|
31
|
+
hash_value
|
32
|
+
end
|
33
|
+
|
23
34
|
def self.load_json(json_path)
|
24
35
|
file = File.read(json_path)
|
25
36
|
data_hash = JSON.parse(file)
|
@@ -53,55 +64,213 @@ module Fastlane
|
|
53
64
|
android_home
|
54
65
|
end
|
55
66
|
|
56
|
-
def self.
|
67
|
+
def self.get_build_tools_version(targeted_version)
|
68
|
+
path = self.get_build_tools(targeted_version)
|
69
|
+
version = path.split('/').last
|
70
|
+
version
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.get_build_tools(targeted_version)
|
57
74
|
android_home = self.get_android_home()
|
58
75
|
build_tools_root = File.join(android_home, '/build-tools')
|
59
76
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
build_tools_last_version = sub_dir
|
77
|
+
build_tools_path = ""
|
78
|
+
if !targeted_version.to_s.strip.empty?
|
79
|
+
build_tools_path = File.join(build_tools_root, "/#{targeted_version}/")
|
64
80
|
end
|
65
81
|
|
66
|
-
|
82
|
+
if !File.directory?(build_tools_path)
|
83
|
+
sub_dirs = Dir.glob(File.join(build_tools_root, '*', ''))
|
84
|
+
build_tools_last_version = ''
|
85
|
+
for sub_dir in sub_dirs
|
86
|
+
build_tools_last_version = sub_dir
|
87
|
+
end
|
88
|
+
build_tools_path = build_tools_last_version
|
89
|
+
end
|
90
|
+
|
91
|
+
build_tools_path
|
67
92
|
end
|
68
93
|
|
69
|
-
def self.
|
70
|
-
|
71
|
-
|
72
|
-
|
94
|
+
def self.check_ssl_version(forceOpenSSL)
|
95
|
+
libressl_min = '2.9'
|
96
|
+
openssl_min = '1.1.1'
|
97
|
+
|
98
|
+
openssl = self.openssl(forceOpenSSL)
|
99
|
+
output = `#{openssl} version`
|
100
|
+
if !output.start_with?("LibreSSL") && !output.start_with?("OpenSSL")
|
101
|
+
raise "Please install OpenSSL '#{openssl_min}' at least OR LibreSSL #{libressl_min}' at least"
|
102
|
+
end
|
103
|
+
UI.message("SSL/TLS protocol library: '#{output.strip!}'")
|
104
|
+
|
105
|
+
# Check minimum verion:
|
106
|
+
vesion = output.to_str.scan(/[0-9\.]{1,}/).first
|
107
|
+
UI.message("SSL/TLS protocol version: '#{vesion}'")
|
108
|
+
if self.is_libre_ssl(forceOpenSSL)
|
109
|
+
if Gem::Version.new(vesion) < Gem::Version.new(libressl_min)
|
110
|
+
raise "Minimum version for LibreSSL is '#{libressl_min}', please update it. Use homebrew is your are Mac user, and update ~/.bah_profile or ~/.zprofile"
|
111
|
+
end
|
112
|
+
else
|
113
|
+
if Gem::Version.new(vesion) > Gem::Version.new(openssl_min)
|
114
|
+
raise "Minimum version for OpenSSL is '#{openssl_min}' please update it. Use homebrew is your are Mac user, and update ~/.bah_profile or ~/.zprofile"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
output.strip
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.openssl(forceOpenSSL)
|
122
|
+
if forceOpenSSL
|
123
|
+
path = openssl_path
|
124
|
+
output = "#{path}/openssl"
|
125
|
+
else
|
126
|
+
output = "openssl"
|
127
|
+
end
|
128
|
+
output
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.is_libre_ssl(forceOpenSSL)
|
132
|
+
result = false
|
133
|
+
openssl = self.openssl(forceOpenSSL)
|
134
|
+
output = `#{openssl} version`
|
135
|
+
if output.start_with?("LibreSSL")
|
136
|
+
result = true
|
73
137
|
end
|
74
|
-
|
138
|
+
result
|
75
139
|
end
|
76
140
|
|
77
|
-
def self.gen_key(key_path, password)
|
141
|
+
def self.gen_key(key_path, password, compat_key)
|
78
142
|
`rm -f '#{key_path}'`
|
79
|
-
|
143
|
+
shaValue = self.sha512(password)
|
144
|
+
# Backward-compatibility
|
145
|
+
if compat_key == "1"
|
146
|
+
`echo "#{password}" | openssl dgst -sha512 | awk '{print $2}' | cut -c1-128 > '#{key_path}'`
|
147
|
+
else
|
148
|
+
`echo "#{shaValue}" > '#{key_path}'`
|
149
|
+
end
|
80
150
|
end
|
81
151
|
|
82
|
-
def self.encrypt_file(clear_file, encrypt_file, key_path)
|
152
|
+
def self.encrypt_file(clear_file, encrypt_file, key_path, forceOpenSSL)
|
83
153
|
`rm -f '#{encrypt_file}'`
|
84
|
-
|
154
|
+
libre_ssl = self.is_libre_ssl(forceOpenSSL)
|
155
|
+
openssl_bin = self.openssl(forceOpenSSL)
|
156
|
+
`#{openssl_bin} enc -aes-256-cbc -salt -pbkdf2 -in '#{clear_file}' -out '#{encrypt_file}' -pass file:'#{key_path}'`
|
85
157
|
end
|
86
158
|
|
87
|
-
def self.decrypt_file(encrypt_file, clear_file, key_path)
|
159
|
+
def self.decrypt_file(encrypt_file, clear_file, key_path, forceOpenSSL)
|
88
160
|
`rm -f '#{clear_file}'`
|
89
|
-
|
161
|
+
libre_ssl = self.is_libre_ssl(forceOpenSSL)
|
162
|
+
openssl_bin = self.openssl(forceOpenSSL)
|
163
|
+
`#{openssl_bin} enc -d -aes-256-cbc -pbkdf2 -in '#{encrypt_file}' -out '#{clear_file}' -pass file:'#{key_path}'`
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.assert_equals(test_name, excepted, value)
|
167
|
+
puts "Unit Test: #{test_name}"
|
168
|
+
if value != excepted
|
169
|
+
puts " - Excepted: #{excepted}"
|
170
|
+
puts " - Returned: #{value}"
|
171
|
+
raise "Unit Test - #{test_name} error!"
|
172
|
+
else
|
173
|
+
puts " - OK"
|
174
|
+
end
|
90
175
|
end
|
91
176
|
|
92
|
-
def self.
|
177
|
+
def self.test_security
|
93
178
|
|
94
|
-
|
95
|
-
|
179
|
+
self.check_ssl_version(false)
|
180
|
+
|
181
|
+
# Clear temp files
|
182
|
+
temp_dir = File.join(Dir.pwd, '/temp/')
|
183
|
+
FileUtils.rm_rf(temp_dir)
|
184
|
+
Dir.mkdir(temp_dir)
|
185
|
+
|
186
|
+
fakeValue = "4esfsf4dsfds!efs5ZDOJF"
|
187
|
+
# Check MD5
|
188
|
+
md5value = self.to_md5(fakeValue)
|
189
|
+
excepted = "1c815cd208fe08076c9e7b6595d121d1"
|
190
|
+
self.assert_equals("MD5", excepted, md5value)
|
191
|
+
|
192
|
+
# Check SHA-512
|
193
|
+
shaValue = self.sha512(fakeValue)
|
194
|
+
excepted = "cc6a7b0d89cc61c053f7018a305672bdb82bc07e5015f64bb063d9662be4ec81ec8afa819b009de266482b6bd56b7068def2524c32f5b5d4d9db49ee4578499d"
|
195
|
+
self.assert_equals("SHA-512", excepted, shaValue)
|
196
|
+
|
197
|
+
# Check SHA-512-File
|
198
|
+
key_path = File.join(Dir.pwd, '/temp/key.txt')
|
199
|
+
self.gen_key(key_path, fakeValue, false)
|
200
|
+
shaValue = self.get_file_content(key_path).strip!
|
201
|
+
excepted = "cc6a7b0d89cc61c053f7018a305672bdb82bc07e5015f64bb063d9662be4ec81ec8afa819b009de266482b6bd56b7068def2524c32f5b5d4d9db49ee4578499d"
|
202
|
+
self.assert_equals("SHA-512-File", excepted, shaValue)
|
203
|
+
|
204
|
+
|
205
|
+
# Check LibreSSL
|
206
|
+
result = self.is_libre_ssl(false)
|
207
|
+
self.assert_equals("Is-LibreSSL", true, result)
|
208
|
+
result = self.is_libre_ssl(true)
|
209
|
+
self.assert_equals("Is-LibreSSL", false, result)
|
210
|
+
|
211
|
+
# Encrypt OpenSSL
|
212
|
+
clear_file = File.join(Dir.pwd, '/temp/clear.txt')
|
213
|
+
openssl_encrypt_file = File.join(Dir.pwd, '/temp/openssl_encrypted.txt')
|
214
|
+
self.content_to_file(clear_file, fakeValue)
|
215
|
+
self.encrypt_file(clear_file, openssl_encrypt_file, key_path, true)
|
216
|
+
result = File.file?(openssl_encrypt_file) && File.size(openssl_encrypt_file) > 10
|
217
|
+
self.assert_equals("Encrypt-OpenSSL", true, result)
|
218
|
+
|
219
|
+
# Encrypt LibreSSL
|
220
|
+
encrypt_file_libre = File.join(Dir.pwd, '/temp/libressl_encrypted.txt')
|
221
|
+
self.content_to_file(clear_file, fakeValue)
|
222
|
+
self.encrypt_file(clear_file, encrypt_file_libre, key_path, false)
|
223
|
+
result = File.file?(encrypt_file_libre) && File.size(encrypt_file_libre) > 10
|
224
|
+
self.assert_equals("Encrypt-LibreSSL", true, result)
|
225
|
+
|
226
|
+
# exit!
|
227
|
+
|
228
|
+
# Decrypt OpenSSL (from OpenSSL)
|
229
|
+
openssl_clear_file = File.join(Dir.pwd, '/temp/openssl_clear.txt')
|
230
|
+
self.decrypt_file(openssl_encrypt_file, openssl_clear_file, key_path, true)
|
231
|
+
decrypted = self.get_file_content(openssl_clear_file).strip!
|
232
|
+
self.assert_equals("Decrypt-OpenSSL", fakeValue, decrypted)
|
233
|
+
|
234
|
+
# Decrypt LibreSSL (from LibreSSL)
|
235
|
+
libressl_clear_file = File.join(Dir.pwd, '/temp/libressl_clear.txt')
|
236
|
+
self.decrypt_file(encrypt_file_libre, libressl_clear_file, key_path, false)
|
237
|
+
decrypted = self.get_file_content(libressl_clear_file).strip!
|
238
|
+
self.assert_equals("Decrypt-LibreSSL", fakeValue, decrypted)
|
239
|
+
|
240
|
+
# Decrypt LibreSSL (from OpenSSL)
|
241
|
+
libressl_clear_file = File.join(Dir.pwd, '/temp/libressl_from_openssl_clear.txt')
|
242
|
+
self.decrypt_file(openssl_encrypt_file, libressl_clear_file, key_path, false)
|
243
|
+
decrypted = self.get_file_content(libressl_clear_file).strip!
|
244
|
+
self.assert_equals("Decrypt-LibreSSL-from-OpenSSL", fakeValue, decrypted)
|
245
|
+
|
246
|
+
# Decrypt OpenSSL (from LibreSSL)
|
247
|
+
openssl_clear_file = File.join(Dir.pwd, '/temp/openssl_from_libressl_clear.txt')
|
248
|
+
self.decrypt_file(encrypt_file_libre, openssl_clear_file, key_path, true)
|
249
|
+
decrypted = self.get_file_content(openssl_clear_file).strip!
|
250
|
+
self.assert_equals("Decrypt-OpenSSL-from-LibreSSL", fakeValue, decrypted)
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
def self.sign_apk(apk_path, keystore_path, key_password, alias_name, alias_password, zip_align, version_targeted)
|
255
|
+
|
256
|
+
build_tools_path = self.get_build_tools(version_targeted)
|
257
|
+
UI.message("Build-tools path: #{build_tools_path}")
|
96
258
|
|
97
259
|
# https://developer.android.com/studio/command-line/zipalign
|
98
|
-
if zip_align
|
260
|
+
if zip_align != false
|
99
261
|
apk_path_aligned = apk_path.gsub(".apk", "-aligned.apk")
|
100
262
|
`rm -f '#{apk_path_aligned}'`
|
101
|
-
UI.message("Aligning APK (zipalign): #{
|
102
|
-
`#{build_tools_path}zipalign -
|
263
|
+
UI.message("Aligning APK (zipalign): #{apk_path}")
|
264
|
+
output = `#{build_tools_path}zipalign -v 4 '#{apk_path}' '#{apk_path_aligned}'`
|
265
|
+
puts ""
|
266
|
+
puts output
|
267
|
+
|
268
|
+
if !File.file?(apk_path_aligned)
|
269
|
+
raise "Aligned APK not exists!"
|
270
|
+
end
|
271
|
+
|
103
272
|
else
|
104
|
-
UI.message("No zip align!")
|
273
|
+
UI.message("No zip align - deactivated via parameter!")
|
105
274
|
apk_path_aligned = apk_path
|
106
275
|
end
|
107
276
|
apk_path_signed = apk_path.gsub(".apk", "-signed.apk")
|
@@ -110,12 +279,44 @@ module Fastlane
|
|
110
279
|
|
111
280
|
# https://developer.android.com/studio/command-line/apksigner
|
112
281
|
`rm -f '#{apk_path_signed}'`
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
282
|
+
UI.message("Signing APK: #{apk_path_aligned}")
|
283
|
+
apksigner_opts = ""
|
284
|
+
build_tools_version = self.get_build_tools_version(version_targeted)
|
285
|
+
UI.message("Build-tools version: #{build_tools_version}")
|
286
|
+
if Gem::Version.new(build_tools_version) >= Gem::Version.new('30')
|
287
|
+
apksigner_opts = "--v4-signing-enabled false "
|
288
|
+
end
|
289
|
+
output = `#{build_tools_path}apksigner sign --ks '#{keystore_path}' --ks-key-alias '#{alias_name}' --ks-pass pass:'#{key_password}' --key-pass pass:'#{alias_password}' --v1-signing-enabled true --v2-signing-enabled true #{apksigner_opts}--out '#{apk_path_signed}' '#{apk_path_aligned}'`
|
290
|
+
puts ""
|
291
|
+
puts output
|
292
|
+
|
293
|
+
UI.message("Verifing APK signature: #{apk_path_signed}")
|
294
|
+
output = `#{build_tools_path}apksigner verify '#{apk_path_signed}'`
|
295
|
+
puts ""
|
296
|
+
puts output
|
297
|
+
if zip_align != false
|
298
|
+
`rm -f '#{apk_path_aligned}'`
|
299
|
+
end
|
117
300
|
|
118
301
|
apk_path_signed
|
302
|
+
end
|
303
|
+
|
304
|
+
def self.resolve_dir(path)
|
305
|
+
if !File.directory?(path)
|
306
|
+
path = File.join(Dir.pwd, path)
|
307
|
+
end
|
308
|
+
path
|
309
|
+
end
|
310
|
+
|
311
|
+
def self.resolve_file(path)
|
312
|
+
if !File.file?(path)
|
313
|
+
path = File.join(Dir.pwd, path)
|
314
|
+
end
|
315
|
+
path
|
316
|
+
end
|
317
|
+
|
318
|
+
def self.content_to_file(file_path, content)
|
319
|
+
`echo #{content} > #{file_path}`
|
119
320
|
end
|
120
321
|
|
121
322
|
def self.get_file_content(file_path)
|
@@ -132,9 +333,7 @@ module Fastlane
|
|
132
333
|
|
133
334
|
if !apk_path.to_s.end_with?(".apk")
|
134
335
|
|
135
|
-
|
136
|
-
apk_path = File.join(Dir.pwd, apk_path)
|
137
|
-
end
|
336
|
+
apk_path = self.resolve_dir(apk_path)
|
138
337
|
|
139
338
|
pattern = File.join(apk_path, '*.apk')
|
140
339
|
files = Dir[pattern]
|
@@ -147,11 +346,7 @@ module Fastlane
|
|
147
346
|
end
|
148
347
|
|
149
348
|
else
|
150
|
-
|
151
|
-
if !File.file?(apk_path)
|
152
|
-
apk_path = File.join(Dir.pwd, apk_path)
|
153
|
-
end
|
154
|
-
|
349
|
+
apk_path = self.resolve_file(apk_path)
|
155
350
|
end
|
156
351
|
|
157
352
|
apk_path
|
@@ -177,6 +372,17 @@ module Fastlane
|
|
177
372
|
match_secret = params[:match_secret]
|
178
373
|
override_keystore = params[:override_keystore]
|
179
374
|
keystore_data = params[:keystore_data]
|
375
|
+
clear_keystore = params[:clear_keystore]
|
376
|
+
unit_test = params[:unit_test]
|
377
|
+
build_tools_version = params[:build_tools_version]
|
378
|
+
zip_align = params[:zip_align]
|
379
|
+
compat_key = params[:compat_key]
|
380
|
+
|
381
|
+
# Test OpenSSL/LibreSSL
|
382
|
+
if unit_test
|
383
|
+
result_test = self.test_security
|
384
|
+
exit!
|
385
|
+
end
|
180
386
|
|
181
387
|
# Init constants:
|
182
388
|
keystore_name = 'keystore.jks'
|
@@ -192,7 +398,7 @@ module Fastlane
|
|
192
398
|
end
|
193
399
|
|
194
400
|
# Check OpenSSL:
|
195
|
-
self.
|
401
|
+
self.check_ssl_version(false)
|
196
402
|
|
197
403
|
# Init workign local directory:
|
198
404
|
dir_name = ENV['HOME'] + '/.match_keystore'
|
@@ -211,7 +417,7 @@ module Fastlane
|
|
211
417
|
raise "Security password is not defined! Please use 'match_secret' parameter for CI."
|
212
418
|
end
|
213
419
|
UI.message "Generating security key '#{key_name}'..."
|
214
|
-
self.gen_key(key_path, security_password)
|
420
|
+
self.gen_key(key_path, security_password, compat_key)
|
215
421
|
end
|
216
422
|
|
217
423
|
# Check is 'security password' is well initialized:
|
@@ -222,14 +428,30 @@ module Fastlane
|
|
222
428
|
raise "The security key '#{key_name}' is malformed, or not initialized!"
|
223
429
|
end
|
224
430
|
|
225
|
-
#
|
431
|
+
# Clear repo Keystore (local) - mostly for testing:
|
226
432
|
repo_dir = File.join(dir_name, self.to_md5(git_url))
|
227
|
-
|
433
|
+
if clear_keystore && File.directory?(repo_dir)
|
434
|
+
FileUtils.rm_rf(repo_dir)
|
435
|
+
UI.message("Local repo keystore (#{repo_dir}) directory deleted!")
|
436
|
+
end
|
437
|
+
|
438
|
+
# Create repo directory to sync remote Keystores repository:
|
228
439
|
unless File.directory?(repo_dir)
|
229
440
|
UI.message("Creating 'repo' directory...")
|
230
441
|
FileUtils.mkdir_p(repo_dir)
|
231
442
|
end
|
232
443
|
|
444
|
+
# Check if package name defined:
|
445
|
+
if package_name.to_s.strip.empty?
|
446
|
+
raise "Package name is not defined!"
|
447
|
+
end
|
448
|
+
|
449
|
+
# Define paths:
|
450
|
+
keystoreAppDir = File.join(repo_dir, package_name)
|
451
|
+
keystore_path = File.join(keystoreAppDir, keystore_name)
|
452
|
+
properties_path = File.join(keystoreAppDir, properties_name)
|
453
|
+
properties_encrypt_path = File.join(keystoreAppDir, properties_encrypt_name)
|
454
|
+
|
233
455
|
# Cloning/pulling GIT remote repository:
|
234
456
|
gitDir = File.join(repo_dir, '/.git')
|
235
457
|
if !File.directory?(gitDir)
|
@@ -244,20 +466,6 @@ module Fastlane
|
|
244
466
|
puts ''
|
245
467
|
end
|
246
468
|
|
247
|
-
# Create sub-directory for Android app:
|
248
|
-
if package_name.to_s.strip.empty?
|
249
|
-
raise "Package name is not defined!"
|
250
|
-
end
|
251
|
-
keystoreAppDir = File.join(repo_dir, package_name)
|
252
|
-
unless File.directory?(keystoreAppDir)
|
253
|
-
UI.message("Creating '#{package_name}' keystore directory...")
|
254
|
-
FileUtils.mkdir_p(keystoreAppDir)
|
255
|
-
end
|
256
|
-
|
257
|
-
keystore_path = File.join(keystoreAppDir, keystore_name)
|
258
|
-
properties_path = File.join(keystoreAppDir, properties_name)
|
259
|
-
properties_encrypt_path = File.join(keystoreAppDir, properties_encrypt_name)
|
260
|
-
|
261
469
|
# Load parameters from JSON for CI or Unit Tests:
|
262
470
|
if keystore_data != nil && File.file?(keystore_data)
|
263
471
|
data_json = self.load_json(keystore_data)
|
@@ -274,6 +482,7 @@ module Fastlane
|
|
274
482
|
|
275
483
|
# Create keystore with command
|
276
484
|
override_keystore = !existing_keystore.to_s.strip.empty? && File.file?(existing_keystore)
|
485
|
+
UI.message("Existing Keystore: #{existing_keystore}")
|
277
486
|
if !File.file?(keystore_path) || override_keystore
|
278
487
|
|
279
488
|
if File.file?(keystore_path)
|
@@ -294,7 +503,7 @@ module Fastlane
|
|
294
503
|
end
|
295
504
|
|
296
505
|
# https://developer.android.com/studio/publish/app-signing
|
297
|
-
if !File.file?(existing_keystore)
|
506
|
+
if existing_keystore.to_s.strip.empty? || !File.file?(existing_keystore)
|
298
507
|
UI.message("Generating Android Keystore...")
|
299
508
|
|
300
509
|
full_name = self.prompt2(text: "Certificate First and Last Name: ", value: data_full_name)
|
@@ -335,7 +544,7 @@ module Fastlane
|
|
335
544
|
out_file.puts("aliasPassword=#{alias_password}")
|
336
545
|
out_file.close
|
337
546
|
|
338
|
-
self.encrypt_file(properties_path, properties_encrypt_path, key_path)
|
547
|
+
self.encrypt_file(properties_path, properties_encrypt_path, key_path, false)
|
339
548
|
File.delete(properties_path)
|
340
549
|
|
341
550
|
# Print Keystore data in repo:
|
@@ -352,9 +561,10 @@ module Fastlane
|
|
352
561
|
else
|
353
562
|
UI.message "Keystore file already exists, continue..."
|
354
563
|
|
355
|
-
self.decrypt_file(properties_encrypt_path, properties_path, key_path)
|
564
|
+
self.decrypt_file(properties_encrypt_path, properties_path, key_path, false)
|
356
565
|
|
357
566
|
properties = self.load_properties(properties_path)
|
567
|
+
Pry::ColorPrinter.pp(properties)
|
358
568
|
key_password = properties['keyPassword']
|
359
569
|
alias_name = properties['aliasName']
|
360
570
|
alias_password = properties['aliasPassword']
|
@@ -380,12 +590,13 @@ module Fastlane
|
|
380
590
|
key_password,
|
381
591
|
alias_name,
|
382
592
|
alias_password,
|
383
|
-
|
593
|
+
zip_align, # Zip align
|
594
|
+
build_tools_version # Buil-tools version
|
384
595
|
)
|
385
596
|
puts ''
|
386
597
|
end
|
387
598
|
else
|
388
|
-
UI.message("No APK file found
|
599
|
+
UI.message("No APK file found at: #{apk_path}")
|
389
600
|
end
|
390
601
|
|
391
602
|
# Prepare contect shared values for next lanes:
|
@@ -457,7 +668,32 @@ module Fastlane
|
|
457
668
|
env_name: "MATCH_KEYSTORE_JSON_PATH",
|
458
669
|
description: "Required data to import an existing keystore, or create a new one",
|
459
670
|
optional: true,
|
460
|
-
type: String)
|
671
|
+
type: String),
|
672
|
+
FastlaneCore::ConfigItem.new(key: :build_tools_version,
|
673
|
+
env_name: "MATCH_KEYSTORE_BUILD_TOOLS_VERSION",
|
674
|
+
description: "Set built-tools version (by default latest available on machine)",
|
675
|
+
optional: true,
|
676
|
+
type: String),
|
677
|
+
FastlaneCore::ConfigItem.new(key: :zip_align,
|
678
|
+
env_name: "MATCH_KEYSTORE_ZIPALIGN",
|
679
|
+
description: "Define if plugin will run zipalign on APK before sign it (true by default)",
|
680
|
+
optional: true,
|
681
|
+
type: Boolean),
|
682
|
+
FastlaneCore::ConfigItem.new(key: :compat_key,
|
683
|
+
env_name: "MATCH_KEYSTORE_COMPAT_KEY",
|
684
|
+
description: "Define the compatibility key version used on local machine (nil by default)",
|
685
|
+
optional: true,
|
686
|
+
type: String),
|
687
|
+
FastlaneCore::ConfigItem.new(key: :clear_keystore,
|
688
|
+
env_name: "MATCH_KEYSTORE_CLEAR",
|
689
|
+
description: "Clear the local keystore (false by default)",
|
690
|
+
optional: true,
|
691
|
+
type: Boolean),
|
692
|
+
FastlaneCore::ConfigItem.new(key: :unit_test,
|
693
|
+
env_name: "MATCH_KEYSTORE_UNIT_TESTS",
|
694
|
+
description: "launch Unit Tests (false by default)",
|
695
|
+
optional: true,
|
696
|
+
type: Boolean)
|
461
697
|
]
|
462
698
|
end
|
463
699
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-match_keystore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher NEY
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|