fastlane-plugin-match_keystore 0.1.3 → 0.1.4
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: 0af6b5ad125ace188811247b482ba84e38bd73cad908e32cb2ddd2193059fd9b
|
4
|
+
data.tar.gz: 01dc72217dd581f967e5c9639459af9557fea5921c9dd6fce4580c75b41ada2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61861369ca1cddf195c96ee6402802b01b686a9864974e68563daef6bb0cd79329289a989b16a22e2dacee7348987e1ebaf0e11610625f634e8d7c17aba055d7
|
7
|
+
data.tar.gz: 1842d84d9bee7a59192a17c3105d1e202d3addcc86f2ea29a582a64847d862d43bee7326fc51c7705de063a1c6ec4483a857d27101919fdd824fb204cefc3879
|
data/README.md
CHANGED
@@ -12,9 +12,13 @@ fastlane add_plugin match_keystore
|
|
12
12
|
|
13
13
|
## About match_keystore
|
14
14
|
|
15
|
-
Easily sync your Android keystores across your team
|
15
|
+
Easily sync your Android keystores across your team.
|
16
16
|
|
17
|
-
|
17
|
+
This plugin was design based on the 'match' plugin and code signing concept: https://codesigning.guide/
|
18
|
+
|
19
|
+
With **match_keystore** you can store all your Android Keystores in secured private repository and share it to your team and your CI system.
|
20
|
+
|
21
|
+
The keystore properties are encrypted with AES in order to secure sensitive data in the Git repository itself.
|
18
22
|
|
19
23
|
## How to use
|
20
24
|
|
@@ -24,11 +28,14 @@ Easily sync your Android keystores across your team
|
|
24
28
|
gradle(task: "clean")
|
25
29
|
gradle(task: 'assemble', build_type: 'Release')
|
26
30
|
|
27
|
-
match_keystore(
|
28
|
-
git_url: "https://github.com/<GITHUB_USERNAME>/keystores.git",
|
31
|
+
signed_apk_path = match_keystore(
|
32
|
+
git_url: "https://github.com/<GITHUB_USERNAME>/keystores.git", # Please use a private Git repository !
|
29
33
|
package_name: "com.your.package.name",
|
30
|
-
apk_path: "/app/build/outputs/apk/app-release.apk"
|
34
|
+
apk_path: "/app/build/outputs/apk/app-release.apk" # Or path without APK: /app/build/outputs/apk/
|
31
35
|
)
|
36
|
+
|
37
|
+
# Return the path of signed APK (useful for other lanes such as `publish_to_firebase`, `upload_to_play_store`)
|
38
|
+
puts signed_apk_path
|
32
39
|
end
|
33
40
|
```
|
34
41
|
|
@@ -84,7 +84,7 @@ module Fastlane
|
|
84
84
|
# https://developer.android.com/studio/command-line/apksigner
|
85
85
|
apk_path_signed = apk_path.gsub(".apk", "-signed.apk")
|
86
86
|
puts `rm -f #{apk_path_signed}`
|
87
|
-
puts `#{build_tools_path}apksigner sign --ks #{keystore_path} --ks-key-alias #{alias_name} --ks-pass pass
|
87
|
+
puts `#{build_tools_path}apksigner sign --ks #{keystore_path} --ks-key-alias '#{alias_name}' --ks-pass pass:'#{alias_password}' --key-pass pass:'#{key_password}' --v1-signing-enabled true --v2-signing-enabled true --out #{apk_path_signed} #{apk_path_aligned}`
|
88
88
|
|
89
89
|
puts `#{build_tools_path}apksigner verify #{apk_path_signed}`
|
90
90
|
puts `rm -f #{apk_path_aligned}`
|
@@ -93,7 +93,7 @@ module Fastlane
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def self.resolve_apk_path(apk_path)
|
96
|
-
|
96
|
+
|
97
97
|
if !apk_path.to_s.end_with?(".apk")
|
98
98
|
|
99
99
|
if !File.directory?(apk_path)
|
@@ -126,6 +126,7 @@ module Fastlane
|
|
126
126
|
git_url = params[:git_url]
|
127
127
|
package_name = params[:package_name]
|
128
128
|
apk_path = params[:apk_path]
|
129
|
+
existing_keystore = params[:existing_keystore]
|
129
130
|
override_keystore = params[:override_keystore]
|
130
131
|
|
131
132
|
keystore_name = 'keystore.jks'
|
@@ -173,8 +174,9 @@ module Fastlane
|
|
173
174
|
properties_path = keystoreAppDir + '/' + properties_name
|
174
175
|
properties_encrypt_path = keystoreAppDir + '/' + properties_encrypt_name
|
175
176
|
|
176
|
-
|
177
|
-
|
177
|
+
# Create keystore with command
|
178
|
+
override_keystore = File.file?(existing_keystore)
|
179
|
+
if !File.file?(keystore_path) || override_keystore
|
178
180
|
|
179
181
|
if File.file?(keystore_path)
|
180
182
|
FileUtils.remove_dir(keystore_path)
|
@@ -184,25 +186,31 @@ module Fastlane
|
|
184
186
|
alias_name = other_action.prompt(text: "Keystore Alias name: ")
|
185
187
|
alias_password = other_action.prompt(text: "Keystore Alias password: ")
|
186
188
|
|
187
|
-
full_name = other_action.prompt(text: "Certificate First and Last Name: ")
|
188
|
-
org_unit = other_action.prompt(text: "Certificate Organisation Unit: ")
|
189
|
-
org = other_action.prompt(text: "Certificate Organisation: ")
|
190
|
-
city_locality = other_action.prompt(text: "Certificate City or Locality: ")
|
191
|
-
state_province = other_action.prompt(text: "Certificate State or Province: ")
|
192
|
-
country = other_action.prompt(text: "Certificate Country Code (XX): ")
|
193
|
-
|
194
189
|
# https://developer.android.com/studio/publish/app-signing
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
"
|
199
|
-
"
|
200
|
-
|
201
|
-
"
|
202
|
-
"
|
203
|
-
|
204
|
-
|
205
|
-
|
190
|
+
if !File.file?(existing_keystore)
|
191
|
+
UI.message("Generating Android Keystore...")
|
192
|
+
|
193
|
+
full_name = other_action.prompt(text: "Certificate First and Last Name: ")
|
194
|
+
org_unit = other_action.prompt(text: "Certificate Organisation Unit: ")
|
195
|
+
org = other_action.prompt(text: "Certificate Organisation: ")
|
196
|
+
city_locality = other_action.prompt(text: "Certificate City or Locality: ")
|
197
|
+
state_province = other_action.prompt(text: "Certificate State or Province: ")
|
198
|
+
country = other_action.prompt(text: "Certificate Country Code (XX): ")
|
199
|
+
|
200
|
+
keytool_parts = [
|
201
|
+
"keytool -genkey -v",
|
202
|
+
"-keystore #{keystore_path}",
|
203
|
+
"-alias #{alias_name}",
|
204
|
+
"-keyalg RSA -keysize 2048 -validity 10000",
|
205
|
+
"-storepass #{alias_password} ",
|
206
|
+
"-keypass #{key_password}",
|
207
|
+
"-dname \"CN=#{full_name}, OU=#{org_unit}, O=#{org}, L=#{city_locality}, S=#{state_province}, C=#{country}\"",
|
208
|
+
]
|
209
|
+
sh keytool_parts.join(" ")
|
210
|
+
else
|
211
|
+
UI.message("Copy existing keystore to match_keystore repository...")
|
212
|
+
puts `cp #{existing_keystore} #{keystore_path}`
|
213
|
+
end
|
206
214
|
|
207
215
|
UI.message("Generating Keystore properties...")
|
208
216
|
|
@@ -249,19 +257,25 @@ module Fastlane
|
|
249
257
|
|
250
258
|
output_signed_apk = ''
|
251
259
|
apk_path = self.resolve_apk_path(apk_path)
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
260
|
+
|
261
|
+
if File.file?(apk_path)
|
262
|
+
UI.message("APK to sign: " + apk_path)
|
263
|
+
|
264
|
+
if File.file?(keystore_path)
|
265
|
+
|
266
|
+
UI.message("Signing the APK...")
|
267
|
+
output_signed_apk = self.sign_apk(
|
268
|
+
apk_path,
|
269
|
+
keystore_path,
|
270
|
+
key_password,
|
271
|
+
alias_name,
|
272
|
+
alias_password,
|
273
|
+
true
|
274
|
+
)
|
275
|
+
end
|
276
|
+
else
|
277
|
+
UI.message("No APK file found to sign!")
|
278
|
+
end
|
265
279
|
|
266
280
|
output_signed_apk
|
267
281
|
|
@@ -295,12 +309,12 @@ module Fastlane
|
|
295
309
|
|
296
310
|
def self.available_options
|
297
311
|
[
|
298
|
-
|
312
|
+
FastlaneCore::ConfigItem.new(key: :git_url,
|
299
313
|
env_name: "MATCH_KEYSTORE_GIT_URL",
|
300
314
|
description: "The URL of the Git repository (Github, BitBucket...)",
|
301
315
|
optional: false,
|
302
316
|
type: String),
|
303
|
-
|
317
|
+
FastlaneCore::ConfigItem.new(key: :package_name,
|
304
318
|
env_name: "MATCH_KEYSTORE_PACKAGE_NAME",
|
305
319
|
description: "The package name of the App",
|
306
320
|
optional: false,
|
@@ -310,7 +324,12 @@ module Fastlane
|
|
310
324
|
description: "Path of the APK file to sign",
|
311
325
|
optional: false,
|
312
326
|
type: String),
|
313
|
-
|
327
|
+
FastlaneCore::ConfigItem.new(key: :existing_keystore,
|
328
|
+
env_name: "MATCH_KEYSTORE_EXISTING",
|
329
|
+
description: "Path of an existing Keystore",
|
330
|
+
optional: true,
|
331
|
+
type: String),
|
332
|
+
FastlaneCore::ConfigItem.new(key: :override_keystore,
|
314
333
|
env_name: "MATCH_KEYSTORE_OVERRIDE",
|
315
334
|
description: "Override an existing Keystore (false by default)",
|
316
335
|
optional: true,
|