fastlane-plugin-sous 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03a0ccddbe0d3dd343cc317ba2ab2346aa2fb08403fddd57e0d8b4b10244db89
|
4
|
+
data.tar.gz: 245586eab3eed442e53bcc9c49bd2d082550b0749ab5cad8f513f9f86e5f6271
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ea10affb8737e97056b012a596426f8f74ea328b11c62301af6227960f7bb0117a5f9641c4bafddb0b71ff9f276c661443791cc8025aa80122c07ceec3873da
|
7
|
+
data.tar.gz: 6ab42ed1c468bd43e7a17ebed7c8016ff1aa3a4a81b469c56a93d203b029dc70c8afd87de57c9be457f34645933b50f48ba6a08b765e80f69f2faf80f83b87c6
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
## Based strongly on the work done at https://github.com/christopherney/fastlane-plugin-match_keystore/blob/master/lib/fastlane/plugin/match_keystore/actions/match_keystore_action.rb
|
2
3
|
|
3
4
|
require 'digest'
|
@@ -16,9 +17,7 @@ module Fastlane
|
|
16
17
|
git_url = params[:git_url]
|
17
18
|
git_branch = params[:git_branch]
|
18
19
|
package_name = params[:package_name]
|
19
|
-
existing_keystore = params[:existing_keystore]
|
20
20
|
match_secret = params[:match_secret]
|
21
|
-
keystore_data = params[:keystore_data]
|
22
21
|
|
23
22
|
# constants:
|
24
23
|
keystore_name = package_name + ".jks"
|
@@ -50,14 +49,14 @@ module Fastlane
|
|
50
49
|
if security_password.to_s.strip.empty?
|
51
50
|
raise "Security password is not defined! Please use 'match_secret' parameter"
|
52
51
|
end
|
53
|
-
UI.message
|
52
|
+
UI.message("Generating security key '#{key_name}'...")
|
54
53
|
self.gen_key(key_path, security_password)
|
55
54
|
end
|
56
55
|
|
57
56
|
# check if password is well initialized
|
58
57
|
tmpkey = self.get_file_content(key_path).strip
|
59
58
|
if tmpkey.length == 128
|
60
|
-
UI.message
|
59
|
+
UI.message("Security key '#{key_name}' initialized")
|
61
60
|
else
|
62
61
|
raise "The security key '#{key_name}' is malformed, or not initialized!"
|
63
62
|
end
|
@@ -71,8 +70,8 @@ module Fastlane
|
|
71
70
|
end
|
72
71
|
|
73
72
|
# cloning/pulling git remote repo
|
74
|
-
|
75
|
-
if !File.directory?(
|
73
|
+
git_dir = File.join(repo_dir, '/.git')
|
74
|
+
if !File.directory?(git_dir)
|
76
75
|
UI.message("Cloning remote Keystores repository...")
|
77
76
|
self.git_clone(git_url, git_branch, self.to_md5(git_url), dir_name)
|
78
77
|
else
|
@@ -84,11 +83,11 @@ module Fastlane
|
|
84
83
|
if package_name.to_s.strip.empty?
|
85
84
|
raise "Package name is not defined!"
|
86
85
|
end
|
87
|
-
|
88
|
-
keystore_path = File.join(
|
89
|
-
keystore_encrypt_path = File.join(
|
86
|
+
keystore_app_dir = File.join(repo_dir, "android")
|
87
|
+
keystore_path = File.join(keystore_app_dir, keystore_name)
|
88
|
+
keystore_encrypt_path = File.join(keystore_app_dir, keystore_encrypt_name)
|
90
89
|
|
91
|
-
|
90
|
+
if !File.file?(keystore_encrypt_path)
|
92
91
|
raise "Cannot find encrypted keystore at path: #{keystore_encrypt_path}. Please make sure you have run `prep` at least once and that the keystore is uploaded to your store."
|
93
92
|
else
|
94
93
|
self.decrypt_file(keystore_encrypt_path, keystore_path, key_path)
|
@@ -96,29 +95,28 @@ module Fastlane
|
|
96
95
|
|
97
96
|
Actions.lane_context[SharedValues::KEYSTORE_PATH] = keystore_path
|
98
97
|
|
99
|
-
keystore_path
|
100
|
-
|
98
|
+
keystore_path
|
101
99
|
end
|
102
100
|
|
103
101
|
def self.git_clone(git_url, git_branch, repo_name, repo_dir)
|
104
|
-
Git.clone(git_url, repo_name, :
|
102
|
+
Git.clone(git_url, repo_name, path: repo_dir, branch: git_branch)
|
105
103
|
end
|
106
104
|
|
107
105
|
def self.git_pull(repo_dir, git_branch)
|
108
106
|
g = Git.open(repo_dir)
|
109
107
|
g.fetch
|
110
|
-
g.checkout("origin/" + git_branch, :
|
108
|
+
g.checkout("origin/" + git_branch, force: true)
|
111
109
|
g.pull("origin", git_branch)
|
112
|
-
end
|
110
|
+
end
|
113
111
|
|
114
112
|
def self.to_md5(value)
|
115
|
-
hash_value = Digest::MD5.hexdigest
|
113
|
+
hash_value = Digest::MD5.hexdigest(value)
|
116
114
|
hash_value
|
117
115
|
end
|
118
116
|
|
119
117
|
def self.check_openssl_version
|
120
118
|
output = `openssl version`
|
121
|
-
|
119
|
+
unless output.start_with?("OpenSSL")
|
122
120
|
raise "Please install OpenSSL at least version 1.1.1 https://www.openssl.org/"
|
123
121
|
end
|
124
122
|
UI.message("OpenSSL v
|
@@ -164,7 +162,7 @@ module Fastlane
|
|
164
162
|
description: "URL to the git repo containing the android secrets",
|
165
163
|
is_string: true,
|
166
164
|
verify_block: proc do |value|
|
167
|
-
|
165
|
+
UI.user_error!("No Android Secrets Git Url given, pass using `git_url: 'url_location'`") unless value && !value.empty?
|
168
166
|
end),
|
169
167
|
FastlaneCore::ConfigItem.new(key: :git_branch,
|
170
168
|
env_name: "SOUS_GIT_BRANCH",
|
@@ -181,7 +179,7 @@ module Fastlane
|
|
181
179
|
description: "The package name of the App",
|
182
180
|
is_string: true,
|
183
181
|
verify_block: proc do |value|
|
184
|
-
|
182
|
+
UI.user_error!("No Android Package Name given, pass using `package_name: 'package_name'`") unless value && !value.empty?
|
185
183
|
end),
|
186
184
|
FastlaneCore::ConfigItem.new(key: :existing_keystore,
|
187
185
|
env_name: "SOUS_KEYSTORE",
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
module Fastlane
|
2
3
|
module Actions
|
3
4
|
module SharedValues
|
@@ -13,23 +14,23 @@ module Fastlane
|
|
13
14
|
alias_password = params[:alias_password]
|
14
15
|
zip_align = params[:zip_align]
|
15
16
|
|
16
|
-
UI.message
|
17
|
+
UI.message("Signing APK #{apk_path}...")
|
17
18
|
apk_path = self.sign_apk(
|
18
19
|
apk_path: apk_path,
|
19
20
|
keystore_path: keystore_path,
|
20
21
|
key_password: key_password,
|
21
22
|
alias_name: alias_name,
|
22
23
|
alias_password: alias_password,
|
23
|
-
zip_align: zip_align
|
24
|
+
zip_align: zip_align
|
25
|
+
)
|
24
26
|
|
25
|
-
Actions.lane_context[SharedValues::
|
27
|
+
Actions.lane_context[SharedValues::SIGNED_APK_PATH] = apk_path
|
26
28
|
|
27
29
|
apk_path
|
28
30
|
end
|
29
31
|
|
30
32
|
def self.sign_apk(apk_path:, keystore_path:, key_password:, alias_name:, alias_password:, zip_align:)
|
31
|
-
|
32
|
-
build_tools_path = self.get_build_tools()
|
33
|
+
build_tools_path = self.get_build_tools
|
33
34
|
|
34
35
|
# https://developer.android.com/studio/command-line/zipalign
|
35
36
|
if zip_align == true
|
@@ -41,6 +42,7 @@ module Fastlane
|
|
41
42
|
else
|
42
43
|
apk_path_aligned = apk_path
|
43
44
|
end
|
45
|
+
|
44
46
|
apk_path_signed = apk_path.gsub(".apk", "-signed.apk")
|
45
47
|
apk_path_signed = apk_path_signed.gsub("unsigned", "")
|
46
48
|
apk_path_signed = apk_path_signed.gsub("--", "-")
|
@@ -49,9 +51,11 @@ module Fastlane
|
|
49
51
|
if File.exist?(apk_path_signed)
|
50
52
|
File.delete(apk_path_signed)
|
51
53
|
end
|
54
|
+
|
52
55
|
sh("#{build_tools_path}apksigner sign --ks \"#{keystore_path}\" --ks-pass pass:\"#{key_password}\" --v1-signing-enabled true --v2-signing-enabled true --out \"#{apk_path_signed}\" \"#{apk_path_aligned}\"")
|
53
|
-
|
56
|
+
|
54
57
|
sh("#{build_tools_path}apksigner verify \"#{apk_path_signed}\"")
|
58
|
+
|
55
59
|
if File.exist?(apk_path_aligned)
|
56
60
|
File.delete(apk_path_aligned)
|
57
61
|
end
|
@@ -65,7 +69,7 @@ module Fastlane
|
|
65
69
|
|
66
70
|
sub_dirs = Dir.glob(File.join(build_tools_root, '*', ''))
|
67
71
|
build_tools_last_version = ''
|
68
|
-
|
72
|
+
sub_dirs.each do |sub_dir|
|
69
73
|
build_tools_last_version = sub_dir
|
70
74
|
end
|
71
75
|
|
@@ -79,21 +83,21 @@ module Fastlane
|
|
79
83
|
description: "Path to the APK File",
|
80
84
|
is_string: true,
|
81
85
|
verify_block: proc do |value|
|
82
|
-
|
86
|
+
UI.user_error!("No APK Path given, pass using `apk_path: 'path to apk'`") unless value && !value.empty?
|
83
87
|
end),
|
84
88
|
FastlaneCore::ConfigItem.new(key: :keystore_path,
|
85
89
|
env_name: "SOUS_KEYSTORE_PATH",
|
86
90
|
description: "Path to the Keystore file to sign APKs",
|
87
91
|
is_string: true,
|
88
92
|
verify_block: proc do |value|
|
89
|
-
|
93
|
+
UI.user_error!("Keystore path is not present, pass using `keystore_path: 'path to keystore'`") unless value && !value.empty?
|
90
94
|
end),
|
91
95
|
FastlaneCore::ConfigItem.new(key: :key_password,
|
92
96
|
env_name: "SOUS_KEY_PASSWORD",
|
93
97
|
description: "Signing Keystore password",
|
94
98
|
is_string: true,
|
95
99
|
verify_block: proc do |value|
|
96
|
-
|
100
|
+
UI.user_error!("No Keystore password given, pass using `key_password: 'password'`") unless value && !value.empty?
|
97
101
|
end),
|
98
102
|
FastlaneCore::ConfigItem.new(key: :alias_name,
|
99
103
|
env_name: "SOUS_ALIAS_NAME",
|
@@ -141,4 +145,4 @@ module Fastlane
|
|
141
145
|
end
|
142
146
|
end
|
143
147
|
end
|
144
|
-
end
|
148
|
+
end
|