fastlane-plugin-match_android 0.3.0
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +90 -0
- data/lib/fastlane/plugin/match_android/actions/match_android_action.rb +789 -0
- data/lib/fastlane/plugin/match_android/helper/match_android_helper.rb +16 -0
- data/lib/fastlane/plugin/match_android/version.rb +5 -0
- data/lib/fastlane/plugin/match_android.rb +16 -0
- metadata +174 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 66277ef14e66cbc4cea74cedb366a8019ec833e14df5af23c21b8f7f3efac2a8
|
4
|
+
data.tar.gz: e198c0e6ba944f9c5842d555d74aec3381142e769a60d186d9ac8ccc9f7fe30a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e0c62027cb77a4d2ee6157f9d64df00bc83b065702c5e63ba2cfade38c6acb8410832b765ae0a7889419bf909fa8ef10b3052e5591b04d3a401a586283a8199
|
7
|
+
data.tar.gz: 3832c3e472f5af3d20abf9fb211ffff686718d9d650fe4e83a5c6519cdaeb7ca1a7b7e640c9883f48b7543de5014aca7f62c84863544bd2d2b8885a34bb83fb4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Christopher NEY <christopher.ney@gmail.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# match_android plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-match_android)
|
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
|
+
|
12
|
+
## Getting Started
|
13
|
+
|
14
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-match_android`, add it to your project by running:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
fastlane add_plugin match_android
|
18
|
+
```
|
19
|
+
|
20
|
+
## About match_android
|
21
|
+
|
22
|
+
*This repo is a fork of [fastlane-plugin-match_keystore](https://github.com/christopherney/fastlane-plugin-match_keystore) with some improvements and bug fixes. The original plugin was not maintained anymore. This updated package is published under a new name to be able to publish & install the plugin.*
|
23
|
+
|
24
|
+
Easily sync your Android keystores across your team.
|
25
|
+
|
26
|
+
This plugin was design based on the 'match' plugin and code signing concept: https://codesigning.guide/
|
27
|
+
|
28
|
+
With **match_android** you can store all your Android Keystores in secured private repository and share it to your team and your CI system.
|
29
|
+
|
30
|
+
The keystore properties are encrypted with AES in order to secure sensitive data in the Git repository itself.
|
31
|
+
|
32
|
+
## How to use
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
lane :release_and_sign do |options|
|
36
|
+
gradle(task: "clean")
|
37
|
+
gradle(task: 'assemble', build_type: 'Release')
|
38
|
+
|
39
|
+
signed_apk_path = match_android(
|
40
|
+
git_url: "https://github.com/<GITHUB_USERNAME>/keystores.git", # Please use a private Git repository !
|
41
|
+
package_name: "com.your.package.name",
|
42
|
+
apk_path: "/app/build/outputs/apk/app-release.apk" # Or path without APK: /app/build/outputs/apk/
|
43
|
+
# Optional:
|
44
|
+
match_secret: "A-very-str0ng-password!", # The secret use to encrypt/decrypt Keystore passwords on Git repo (for CI)
|
45
|
+
existing_keystore: "assets/existing-keystore.jks", # Optional, if needed to import an existing keystore
|
46
|
+
override_keystore: true, # Optional, override an existing Keystore on Git repo
|
47
|
+
keystore_data: "assets/keystore.json" # Optional, all data required to create a new Keystore (use to bypass prompt)
|
48
|
+
)
|
49
|
+
|
50
|
+
# Return the path of signed APK (useful for other lanes such as `publish_to_firebase`, `upload_to_play_store`)
|
51
|
+
puts signed_apk_path
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
You can build aab files as well by providing an `aab_path` instead of an `apk_path`.
|
56
|
+
|
57
|
+
## Example
|
58
|
+
|
59
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
60
|
+
|
61
|
+
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
62
|
+
|
63
|
+
## Run tests for this plugin
|
64
|
+
|
65
|
+
To run both the tests, and code style validation, run
|
66
|
+
|
67
|
+
```
|
68
|
+
rake
|
69
|
+
```
|
70
|
+
|
71
|
+
To automatically fix many of the styling issues, use
|
72
|
+
```
|
73
|
+
rubocop -a
|
74
|
+
```
|
75
|
+
|
76
|
+
## Issues and Feedback
|
77
|
+
|
78
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
79
|
+
|
80
|
+
## Troubleshooting
|
81
|
+
|
82
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
83
|
+
|
84
|
+
## Using _fastlane_ Plugins
|
85
|
+
|
86
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
87
|
+
|
88
|
+
## About _fastlane_
|
89
|
+
|
90
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,789 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'os'
|
4
|
+
require 'json'
|
5
|
+
require 'digest'
|
6
|
+
require_relative '../helper/match_android_helper'
|
7
|
+
|
8
|
+
module Fastlane
|
9
|
+
module Actions
|
10
|
+
module SharedValues
|
11
|
+
MATCH_ANDROID_PATH = :MATCH_ANDROID_PATH
|
12
|
+
MATCH_ANDROID_ALIAS_NAME = :MATCH_ANDROID_ALIAS_NAME
|
13
|
+
MATCH_ANDROID_APK_SIGNED = :MATCH_ANDROID_APK_SIGNED
|
14
|
+
MATCH_ANDROID_AAB_SIGNED = :MATCH_ANDROID_AAB_SIGNED
|
15
|
+
end
|
16
|
+
|
17
|
+
class MatchKeystoreAction < Action
|
18
|
+
|
19
|
+
KEY_VERSION = "2"
|
20
|
+
OPENSSL_BIN_PATH_MAC = "/usr/local/opt/openssl@1.1/bin"
|
21
|
+
|
22
|
+
def self.to_md5(value)
|
23
|
+
hash_value = Digest::MD5.hexdigest value
|
24
|
+
hash_value
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.sha512(value)
|
28
|
+
hash_value = Digest::SHA512.hexdigest value
|
29
|
+
hash_value
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.load_json(json_path)
|
33
|
+
file = File.read(json_path)
|
34
|
+
data_hash = JSON.parse(file)
|
35
|
+
data_hash
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.load_properties(properties_filename)
|
39
|
+
properties = {}
|
40
|
+
File.open(properties_filename, 'r') do |properties_file|
|
41
|
+
properties_file.read.each_line do |line|
|
42
|
+
line.strip!
|
43
|
+
if (line[0] != ?# and line[0] != ?=)
|
44
|
+
i = line.index('=')
|
45
|
+
if (i)
|
46
|
+
properties[line[0..i - 1].strip] = line[i + 1..-1].strip
|
47
|
+
else
|
48
|
+
properties[line] = ''
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
properties
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.get_android_home
|
57
|
+
`rm -f android_home.txt`
|
58
|
+
`echo $ANDROID_HOME > android_home.txt`
|
59
|
+
data = File.read("android_home.txt")
|
60
|
+
android_home = data.strip
|
61
|
+
`rm -f android_home.txt`
|
62
|
+
android_home
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.get_build_tools_version(targeted_version)
|
66
|
+
path = self.get_build_tools(targeted_version)
|
67
|
+
version = path.split('/').last
|
68
|
+
version
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.get_build_tools(targeted_version)
|
72
|
+
android_home = self.get_android_home()
|
73
|
+
build_tools_root = File.join(android_home, '/build-tools')
|
74
|
+
|
75
|
+
build_tools_path = ""
|
76
|
+
if !targeted_version.to_s.strip.empty?
|
77
|
+
build_tools_path = File.join(build_tools_root, "/#{targeted_version}/")
|
78
|
+
end
|
79
|
+
|
80
|
+
if !File.directory?(build_tools_path)
|
81
|
+
sub_dirs = Dir.glob(File.join(build_tools_root, '*', ''))
|
82
|
+
build_tools_last_version = ''
|
83
|
+
for sub_dir in sub_dirs
|
84
|
+
build_tools_last_version = sub_dir
|
85
|
+
end
|
86
|
+
build_tools_path = build_tools_last_version
|
87
|
+
end
|
88
|
+
|
89
|
+
build_tools_path
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.check_ssl_version(forceOpenSSL)
|
93
|
+
libressl_min = '2.9'
|
94
|
+
openssl_min = '1.1.1'
|
95
|
+
|
96
|
+
openssl = self.openssl(forceOpenSSL)
|
97
|
+
output = `#{openssl} version`
|
98
|
+
if !output.start_with?("LibreSSL") && !output.start_with?("OpenSSL")
|
99
|
+
raise "Please install OpenSSL '#{openssl_min}' at least OR LibreSSL #{libressl_min}' at least"
|
100
|
+
end
|
101
|
+
UI.message("SSL/TLS protocol library: '#{output.strip!}'")
|
102
|
+
|
103
|
+
# Check minimum verion:
|
104
|
+
vesion = output.to_str.scan(/[0-9\.]{1,}/).first
|
105
|
+
UI.message("SSL/TLS protocol version: '#{vesion}'")
|
106
|
+
if self.is_libre_ssl(forceOpenSSL)
|
107
|
+
if Gem::Version.new(vesion) < Gem::Version.new(libressl_min)
|
108
|
+
raise "Minimum version for LibreSSL is '#{libressl_min}', please update it. Use homebrew is your are Mac user, and update ~/.bash_profile or ~/.zprofile"
|
109
|
+
end
|
110
|
+
else
|
111
|
+
if Gem::Version.new(vesion) > Gem::Version.new(openssl_min)
|
112
|
+
raise "Minimum version for OpenSSL is '#{openssl_min}' please update it. Use homebrew is your are Mac user, and update ~/.bash_profile or ~/.zprofile"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
output.strip
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.openssl(forceOpenSSL)
|
120
|
+
if forceOpenSSL
|
121
|
+
output = "#{self::OPENSSL_BIN_PATH_MAC}/openssl"
|
122
|
+
else
|
123
|
+
output = "openssl"
|
124
|
+
end
|
125
|
+
output
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.is_libre_ssl(forceOpenSSL)
|
129
|
+
result = false
|
130
|
+
openssl = self.openssl(forceOpenSSL)
|
131
|
+
output = `#{openssl} version`
|
132
|
+
if output.start_with?("LibreSSL")
|
133
|
+
result = true
|
134
|
+
end
|
135
|
+
result
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.gen_key(key_path, password, compat_key)
|
139
|
+
`rm -f '#{key_path}'`
|
140
|
+
shaValue = self.sha512(password)
|
141
|
+
# Backward-compatibility
|
142
|
+
if compat_key == "1"
|
143
|
+
`echo "#{password}" | openssl dgst -sha512 | awk '{print $2}' | cut -c1-128 > '#{key_path}'`
|
144
|
+
else
|
145
|
+
`echo "#{shaValue}" > '#{key_path}'`
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.encrypt_file(clear_file, encrypt_file, key_path, forceOpenSSL)
|
150
|
+
`rm -f '#{encrypt_file}'`
|
151
|
+
libre_ssl = self.is_libre_ssl(forceOpenSSL)
|
152
|
+
openssl_bin = self.openssl(forceOpenSSL)
|
153
|
+
`#{openssl_bin} enc -aes-256-cbc -salt -pbkdf2 -in '#{clear_file}' -out '#{encrypt_file}' -pass file:'#{key_path}'`
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.decrypt_file(encrypt_file, clear_file, key_path, forceOpenSSL)
|
157
|
+
`rm -f '#{clear_file}'`
|
158
|
+
libre_ssl = self.is_libre_ssl(forceOpenSSL)
|
159
|
+
openssl_bin = self.openssl(forceOpenSSL)
|
160
|
+
`#{openssl_bin} enc -d -aes-256-cbc -pbkdf2 -in '#{encrypt_file}' -out '#{clear_file}' -pass file:'#{key_path}'`
|
161
|
+
end
|
162
|
+
|
163
|
+
def self.assert_equals(test_name, excepted, value)
|
164
|
+
puts "Unit Test: #{test_name}"
|
165
|
+
if value != excepted
|
166
|
+
puts " - Excepted: #{excepted}"
|
167
|
+
puts " - Returned: #{value}"
|
168
|
+
raise "Unit Test - #{test_name} error!"
|
169
|
+
else
|
170
|
+
puts " - OK"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.test_security
|
175
|
+
|
176
|
+
self.check_ssl_version(false)
|
177
|
+
|
178
|
+
# Clear temp files
|
179
|
+
temp_dir = File.join(Dir.pwd, '/temp/')
|
180
|
+
FileUtils.rm_rf(temp_dir)
|
181
|
+
Dir.mkdir(temp_dir)
|
182
|
+
|
183
|
+
fakeValue = "4esfsf4dsfds!efs5ZDOJF"
|
184
|
+
# Check MD5
|
185
|
+
md5value = self.to_md5(fakeValue)
|
186
|
+
excepted = "1c815cd208fe08076c9e7b6595d121d1"
|
187
|
+
self.assert_equals("MD5", excepted, md5value)
|
188
|
+
|
189
|
+
# Check SHA-512
|
190
|
+
shaValue = self.sha512(fakeValue)
|
191
|
+
excepted = "cc6a7b0d89cc61c053f7018a305672bdb82bc07e5015f64bb063d9662be4ec81ec8afa819b009de266482b6bd56b7068def2524c32f5b5d4d9db49ee4578499d"
|
192
|
+
self.assert_equals("SHA-512", excepted, shaValue)
|
193
|
+
|
194
|
+
# Check SHA-512-File
|
195
|
+
key_path = File.join(Dir.pwd, '/temp/key.txt')
|
196
|
+
self.gen_key(key_path, fakeValue, false)
|
197
|
+
shaValue = self.get_file_content(key_path).strip!
|
198
|
+
excepted = "cc6a7b0d89cc61c053f7018a305672bdb82bc07e5015f64bb063d9662be4ec81ec8afa819b009de266482b6bd56b7068def2524c32f5b5d4d9db49ee4578499d"
|
199
|
+
self.assert_equals("SHA-512-File", excepted, shaValue)
|
200
|
+
|
201
|
+
|
202
|
+
# Check LibreSSL
|
203
|
+
result = self.is_libre_ssl(false)
|
204
|
+
self.assert_equals("Is-LibreSSL", true, result)
|
205
|
+
result = self.is_libre_ssl(true)
|
206
|
+
self.assert_equals("Is-LibreSSL", false, result)
|
207
|
+
|
208
|
+
# Encrypt OpenSSL
|
209
|
+
clear_file = File.join(Dir.pwd, '/temp/clear.txt')
|
210
|
+
openssl_encrypt_file = File.join(Dir.pwd, '/temp/openssl_encrypted.txt')
|
211
|
+
self.content_to_file(clear_file, fakeValue)
|
212
|
+
self.encrypt_file(clear_file, openssl_encrypt_file, key_path, true)
|
213
|
+
result = File.file?(openssl_encrypt_file) && File.size(openssl_encrypt_file) > 10
|
214
|
+
self.assert_equals("Encrypt-OpenSSL", true, result)
|
215
|
+
|
216
|
+
# Encrypt LibreSSL
|
217
|
+
encrypt_file_libre = File.join(Dir.pwd, '/temp/libressl_encrypted.txt')
|
218
|
+
self.content_to_file(clear_file, fakeValue)
|
219
|
+
self.encrypt_file(clear_file, encrypt_file_libre, key_path, false)
|
220
|
+
result = File.file?(encrypt_file_libre) && File.size(encrypt_file_libre) > 10
|
221
|
+
self.assert_equals("Encrypt-LibreSSL", true, result)
|
222
|
+
|
223
|
+
# exit!
|
224
|
+
|
225
|
+
# Decrypt OpenSSL (from OpenSSL)
|
226
|
+
openssl_clear_file = File.join(Dir.pwd, '/temp/openssl_clear.txt')
|
227
|
+
self.decrypt_file(openssl_encrypt_file, openssl_clear_file, key_path, true)
|
228
|
+
decrypted = self.get_file_content(openssl_clear_file).strip!
|
229
|
+
self.assert_equals("Decrypt-OpenSSL", fakeValue, decrypted)
|
230
|
+
|
231
|
+
# Decrypt LibreSSL (from LibreSSL)
|
232
|
+
libressl_clear_file = File.join(Dir.pwd, '/temp/libressl_clear.txt')
|
233
|
+
self.decrypt_file(encrypt_file_libre, libressl_clear_file, key_path, false)
|
234
|
+
decrypted = self.get_file_content(libressl_clear_file).strip!
|
235
|
+
self.assert_equals("Decrypt-LibreSSL", fakeValue, decrypted)
|
236
|
+
|
237
|
+
# Decrypt LibreSSL (from OpenSSL)
|
238
|
+
libressl_clear_file = File.join(Dir.pwd, '/temp/libressl_from_openssl_clear.txt')
|
239
|
+
self.decrypt_file(openssl_encrypt_file, libressl_clear_file, key_path, false)
|
240
|
+
decrypted = self.get_file_content(libressl_clear_file).strip!
|
241
|
+
self.assert_equals("Decrypt-LibreSSL-from-OpenSSL", fakeValue, decrypted)
|
242
|
+
|
243
|
+
# Decrypt OpenSSL (from LibreSSL)
|
244
|
+
openssl_clear_file = File.join(Dir.pwd, '/temp/openssl_from_libressl_clear.txt')
|
245
|
+
self.decrypt_file(encrypt_file_libre, openssl_clear_file, key_path, true)
|
246
|
+
decrypted = self.get_file_content(openssl_clear_file).strip!
|
247
|
+
self.assert_equals("Decrypt-OpenSSL-from-LibreSSL", fakeValue, decrypted)
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
def self.sign_apk(apk_path, keystore_path, key_password, alias_name, alias_password, zip_align, version_targeted)
|
252
|
+
|
253
|
+
build_tools_path = self.get_build_tools(version_targeted)
|
254
|
+
UI.message("Build-tools path: #{build_tools_path}")
|
255
|
+
|
256
|
+
# https://developer.android.com/studio/command-line/apksigner
|
257
|
+
apk_path_signed = apk_path.gsub(".apk", "-signed.apk")
|
258
|
+
apk_path_signed = apk_path_signed.gsub("unsigned", "")
|
259
|
+
apk_path_signed = apk_path_signed.gsub("--", "-")
|
260
|
+
`rm -f '#{apk_path_signed}'`
|
261
|
+
|
262
|
+
UI.message("Signing APK (input): #{apk_path}")
|
263
|
+
apksigner_opts = ""
|
264
|
+
build_tools_version = self.get_build_tools_version(version_targeted)
|
265
|
+
UI.message("Build-tools version: #{build_tools_version}")
|
266
|
+
if Gem::Version.new(build_tools_version) >= Gem::Version.new('30')
|
267
|
+
apksigner_opts = "--v4-signing-enabled false "
|
268
|
+
end
|
269
|
+
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}'`
|
270
|
+
puts ""
|
271
|
+
puts output
|
272
|
+
|
273
|
+
UI.message("Verifing APK signature (output): #{apk_path_signed}")
|
274
|
+
output = `#{build_tools_path}apksigner verify '#{apk_path_signed}'`
|
275
|
+
puts ""
|
276
|
+
puts output
|
277
|
+
|
278
|
+
|
279
|
+
# https://developer.android.com/studio/command-line/zipalign
|
280
|
+
if zip_align != false
|
281
|
+
apk_path_aligned = apk_path_signed.gsub(".apk", "-aligned.apk")
|
282
|
+
`rm -f '#{apk_path_aligned}'`
|
283
|
+
UI.message("Aligning APK (zipalign): #{apk_path_signed}")
|
284
|
+
output = `#{build_tools_path}zipalign -v 4 '#{apk_path_signed}' '#{apk_path_aligned}'`
|
285
|
+
puts ""
|
286
|
+
puts output
|
287
|
+
|
288
|
+
if !File.file?(apk_path_aligned)
|
289
|
+
raise "Aligned APK not exists!"
|
290
|
+
end
|
291
|
+
|
292
|
+
`rm -f '#{apk_path_signed}'`
|
293
|
+
apk_path_signed = apk_path_aligned
|
294
|
+
|
295
|
+
else
|
296
|
+
UI.message("No zip align - deactivated via parameter!")
|
297
|
+
end
|
298
|
+
|
299
|
+
apk_path_signed
|
300
|
+
end
|
301
|
+
|
302
|
+
def self.sign_aab(aab_path, keystore_path, key_password, alias_name, alias_password)
|
303
|
+
|
304
|
+
aab_path_signed = aab_path.gsub('.aab', '-signed.aab')
|
305
|
+
aab_path_signed = aab_path_signed.gsub('unsigned', '')
|
306
|
+
aab_path_signed = aab_path_signed.gsub('--', '-')
|
307
|
+
`rm -f '#{aab_path_signed}'`
|
308
|
+
|
309
|
+
UI.message("Signing AAB (input): #{aab_path}")
|
310
|
+
aabsigner_opts = ""
|
311
|
+
output = `jarsigner -keystore '#{keystore_path}' -storepass '#{key_password}' -keypass '#{alias_password}' -signedjar '#{aab_path_signed}' '#{aab_path}' '#{alias_name}'`
|
312
|
+
puts ""
|
313
|
+
puts output
|
314
|
+
|
315
|
+
aab_path_signed
|
316
|
+
end
|
317
|
+
|
318
|
+
def self.resolve_dir(path)
|
319
|
+
if !File.directory?(path)
|
320
|
+
path = File.join(Dir.pwd, path)
|
321
|
+
end
|
322
|
+
path
|
323
|
+
end
|
324
|
+
|
325
|
+
def self.resolve_file(path)
|
326
|
+
if !File.file?(path)
|
327
|
+
path = File.join(Dir.pwd, path)
|
328
|
+
end
|
329
|
+
path
|
330
|
+
end
|
331
|
+
|
332
|
+
def self.content_to_file(file_path, content)
|
333
|
+
`echo #{content} > #{file_path}`
|
334
|
+
end
|
335
|
+
|
336
|
+
def self.get_file_content(file_path)
|
337
|
+
data = File.read(file_path)
|
338
|
+
data
|
339
|
+
end
|
340
|
+
|
341
|
+
def self.resolve_aab_path(aab_path)
|
342
|
+
|
343
|
+
# Set default AAB path if not set:
|
344
|
+
if aab_path.to_s.strip.empty?
|
345
|
+
aab_path = '/app/build/outputs/bundle/release/'
|
346
|
+
end
|
347
|
+
|
348
|
+
if !aab_path.to_s.end_with?('.aab')
|
349
|
+
|
350
|
+
aab_path = self.resolve_dir(aab_path)
|
351
|
+
|
352
|
+
pattern = File.join(aab_path, '*.aab')
|
353
|
+
files = Dir[pattern]
|
354
|
+
|
355
|
+
for file in files
|
356
|
+
if file.to_s.end_with?('.aab') && !file.to_s.end_with?("-signed.aab")
|
357
|
+
apk_path = file
|
358
|
+
break
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
else
|
363
|
+
aab_path = self.resolve_file(aab_path)
|
364
|
+
end
|
365
|
+
|
366
|
+
aab_path
|
367
|
+
end
|
368
|
+
|
369
|
+
def self.resolve_apk_path(apk_path)
|
370
|
+
|
371
|
+
# Set default APK path if not set:
|
372
|
+
if apk_path.to_s.strip.empty?
|
373
|
+
apk_path = '/app/build/outputs/apk/'
|
374
|
+
end
|
375
|
+
|
376
|
+
if !apk_path.to_s.end_with?(".apk")
|
377
|
+
|
378
|
+
apk_path = self.resolve_dir(apk_path)
|
379
|
+
|
380
|
+
pattern = File.join(apk_path, '*.apk')
|
381
|
+
files = Dir[pattern]
|
382
|
+
|
383
|
+
for file in files
|
384
|
+
if file.to_s.end_with?(".apk") && !file.to_s.end_with?("-signed.apk")
|
385
|
+
apk_path = file
|
386
|
+
break
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
else
|
391
|
+
apk_path = self.resolve_file(apk_path)
|
392
|
+
end
|
393
|
+
|
394
|
+
apk_path
|
395
|
+
end
|
396
|
+
|
397
|
+
def self.prompt2(params)
|
398
|
+
# UI.message("prompt2: #{params[:value]}")
|
399
|
+
if params[:value].to_s.empty?
|
400
|
+
return_value = other_action.prompt(text: params[:text], secure_text: params[:secure_text], ci_input: params[:ci_input])
|
401
|
+
else
|
402
|
+
return_value = params[:value]
|
403
|
+
end
|
404
|
+
return_value
|
405
|
+
end
|
406
|
+
|
407
|
+
def self.run(params)
|
408
|
+
|
409
|
+
# Get input parameters:
|
410
|
+
git_url = params[:git_url]
|
411
|
+
package_name = params[:package_name]
|
412
|
+
apk_path = params[:apk_path]
|
413
|
+
aab_path = params[:aab_path]
|
414
|
+
existing_keystore = params[:existing_keystore]
|
415
|
+
match_secret = params[:match_secret]
|
416
|
+
override_keystore = params[:override_keystore]
|
417
|
+
keystore_data = params[:keystore_data]
|
418
|
+
clear_keystore = params[:clear_keystore]
|
419
|
+
unit_test = params[:unit_test]
|
420
|
+
build_tools_version = params[:build_tools_version]
|
421
|
+
zip_align = params[:zip_align]
|
422
|
+
compat_key = params[:compat_key]
|
423
|
+
|
424
|
+
# Test OpenSSL/LibreSSL
|
425
|
+
if unit_test
|
426
|
+
result_test = self.test_security
|
427
|
+
exit!
|
428
|
+
end
|
429
|
+
|
430
|
+
# Init constants:
|
431
|
+
keystore_name = 'keystore.jks'
|
432
|
+
properties_name = 'keystore.properties'
|
433
|
+
keystore_info_name = 'keystore.txt'
|
434
|
+
properties_encrypt_name = 'keystore.properties.enc'
|
435
|
+
|
436
|
+
# Check Android Home env:
|
437
|
+
android_home = self.get_android_home()
|
438
|
+
UI.message("Android SDK: #{android_home}")
|
439
|
+
if android_home.to_s.strip.empty?
|
440
|
+
raise "The environment variable ANDROID_HOME is not defined, or Android SDK is not installed!"
|
441
|
+
end
|
442
|
+
|
443
|
+
# Check OpenSSL:
|
444
|
+
self.check_ssl_version(false)
|
445
|
+
|
446
|
+
# Check is backward-compatibility is required:
|
447
|
+
if !compat_key.to_s.strip.empty?
|
448
|
+
UI.message("Compatiblity version: #{compat_key}")
|
449
|
+
end
|
450
|
+
|
451
|
+
# Init workign local directory:
|
452
|
+
dir_name = ENV['HOME'] + '/.match_android'
|
453
|
+
unless File.directory?(dir_name)
|
454
|
+
UI.message("Creating '.match_android' working directory...")
|
455
|
+
FileUtils.mkdir_p(dir_name)
|
456
|
+
end
|
457
|
+
|
458
|
+
# Init 'security password' for AES encryption:
|
459
|
+
if compat_key == "1"
|
460
|
+
key_name = "#{self.to_md5(git_url)}.hex"
|
461
|
+
else
|
462
|
+
key_name = "#{self.to_md5(git_url)}-#{self::KEY_VERSION}.hex"
|
463
|
+
end
|
464
|
+
key_path = File.join(dir_name, key_name)
|
465
|
+
# UI.message(key_path)
|
466
|
+
if !File.file?(key_path)
|
467
|
+
security_password = self.prompt2(text: "Security password: ", secure_text: true, value: match_secret)
|
468
|
+
if security_password.to_s.strip.empty?
|
469
|
+
raise "Security password is not defined! Please use 'match_secret' parameter for CI."
|
470
|
+
end
|
471
|
+
UI.message "Generating security key '#{key_name}'..."
|
472
|
+
self.gen_key(key_path, security_password, compat_key)
|
473
|
+
end
|
474
|
+
|
475
|
+
# Check is 'security password' is well initialized:
|
476
|
+
tmpkey = self.get_file_content(key_path).strip
|
477
|
+
if tmpkey.length == 128
|
478
|
+
UI.message "Security key '#{key_name}' initialized"
|
479
|
+
else
|
480
|
+
raise "The security key '#{key_name}' is malformed, or not initialized!"
|
481
|
+
end
|
482
|
+
|
483
|
+
# Clear repo Keystore (local) - mostly for testing:
|
484
|
+
repo_dir = File.join(dir_name, self.to_md5(git_url))
|
485
|
+
if clear_keystore && File.directory?(repo_dir)
|
486
|
+
FileUtils.rm_rf(repo_dir)
|
487
|
+
UI.message("Local repo keystore (#{repo_dir}) directory deleted!")
|
488
|
+
end
|
489
|
+
|
490
|
+
# Create repo directory to sync remote Keystores repository:
|
491
|
+
unless File.directory?(repo_dir)
|
492
|
+
UI.message("Creating 'repo' directory...")
|
493
|
+
FileUtils.mkdir_p(repo_dir)
|
494
|
+
end
|
495
|
+
|
496
|
+
# Check if package name defined:
|
497
|
+
if package_name.to_s.strip.empty?
|
498
|
+
raise "Package name is not defined!"
|
499
|
+
end
|
500
|
+
|
501
|
+
# Define paths:
|
502
|
+
keystoreAppDir = File.join(repo_dir, package_name)
|
503
|
+
keystore_path = File.join(keystoreAppDir, keystore_name)
|
504
|
+
properties_path = File.join(keystoreAppDir, properties_name)
|
505
|
+
properties_encrypt_path = File.join(keystoreAppDir, properties_encrypt_name)
|
506
|
+
|
507
|
+
# Cloning/pulling GIT remote repository:
|
508
|
+
gitDir = File.join(repo_dir, '/.git')
|
509
|
+
if !File.directory?(gitDir)
|
510
|
+
UI.message("Cloning remote Keystores repository...")
|
511
|
+
`git clone #{git_url} #{repo_dir}`
|
512
|
+
else
|
513
|
+
UI.message("Pulling remote Keystores repository...")
|
514
|
+
`cd #{repo_dir} && git pull`
|
515
|
+
end
|
516
|
+
|
517
|
+
# Load parameters from JSON for CI or Unit Tests:
|
518
|
+
if keystore_data != nil && File.file?(keystore_data)
|
519
|
+
data_json = self.load_json(keystore_data)
|
520
|
+
data_key_password = data_json['key_password']
|
521
|
+
data_alias_name = data_json['alias_name']
|
522
|
+
data_alias_password = data_json['alias_password']
|
523
|
+
data_full_name = data_json['full_name']
|
524
|
+
data_org_unit = data_json['org_unit']
|
525
|
+
data_org = data_json['org']
|
526
|
+
data_city_locality = data_json['city_locality']
|
527
|
+
data_state_province = data_json['state_province']
|
528
|
+
data_country = data_json['country']
|
529
|
+
end
|
530
|
+
|
531
|
+
# Create keystore with command
|
532
|
+
override_keystore = !existing_keystore.to_s.strip.empty? && File.file?(existing_keystore)
|
533
|
+
UI.message("Existing Keystore: #{existing_keystore}")
|
534
|
+
if !File.file?(keystore_path) || override_keystore
|
535
|
+
|
536
|
+
if File.file?(keystore_path)
|
537
|
+
FileUtils.remove_dir(keystore_path)
|
538
|
+
end
|
539
|
+
|
540
|
+
key_password = self.prompt2(text: "Keystore Password: ", value: data_key_password)
|
541
|
+
if key_password.to_s.strip.empty?
|
542
|
+
raise "Keystore Password is not definined!"
|
543
|
+
end
|
544
|
+
alias_name = self.prompt2(text: "Keystore Alias name: ", value: data_alias_name)
|
545
|
+
if alias_name.to_s.strip.empty?
|
546
|
+
raise "Keystore Alias name is not definined!"
|
547
|
+
end
|
548
|
+
alias_password = self.prompt2(text: "Keystore Alias password: ", value: data_alias_password)
|
549
|
+
if alias_password.to_s.strip.empty?
|
550
|
+
raise "Keystore Alias password is not definined!"
|
551
|
+
end
|
552
|
+
|
553
|
+
# https://developer.android.com/studio/publish/app-signing
|
554
|
+
if existing_keystore.to_s.strip.empty? || !File.file?(existing_keystore)
|
555
|
+
UI.message("Generating Android Keystore...")
|
556
|
+
|
557
|
+
full_name = self.prompt2(text: "Certificate First and Last Name: ", value: data_full_name)
|
558
|
+
org_unit = self.prompt2(text: "Certificate Organisation Unit: ", value: data_org_unit)
|
559
|
+
org = self.prompt2(text: "Certificate Organisation: ", value: data_org)
|
560
|
+
city_locality = self.prompt2(text: "Certificate City or Locality: ", value: data_city_locality)
|
561
|
+
state_province = self.prompt2(text: "Certificate State or Province: ", value: data_state_province)
|
562
|
+
country = self.prompt2(text: "Certificate Country Code (XX): ", value: data_country)
|
563
|
+
|
564
|
+
keytool_parts = [
|
565
|
+
"keytool -genkey -v",
|
566
|
+
"-keystore '#{keystore_path}'",
|
567
|
+
"-alias '#{alias_name}'",
|
568
|
+
"-keyalg RSA -keysize 2048 -validity 10000",
|
569
|
+
"-storepass '#{alias_password}'",
|
570
|
+
"-keypass '#{key_password}'",
|
571
|
+
"-dname \"CN=#{full_name}, OU=#{org_unit}, O=#{org}, L=#{city_locality}, S=#{state_province}, C=#{country}\"",
|
572
|
+
]
|
573
|
+
sh keytool_parts.join(" ")
|
574
|
+
else
|
575
|
+
UI.message("Copy existing keystore to match_android repository...")
|
576
|
+
`cp #{existing_keystore} #{keystore_path}`
|
577
|
+
end
|
578
|
+
|
579
|
+
UI.message("Generating Keystore properties...")
|
580
|
+
|
581
|
+
if File.file?(properties_path)
|
582
|
+
FileUtils.remove_dir(properties_path)
|
583
|
+
end
|
584
|
+
|
585
|
+
# Build URL:
|
586
|
+
store_file = git_url + '/' + package_name + '/' + keystore_name
|
587
|
+
|
588
|
+
out_file = File.new(properties_path, "w")
|
589
|
+
out_file.puts("keyFile=#{store_file}")
|
590
|
+
out_file.puts("keyPassword=#{key_password}")
|
591
|
+
out_file.puts("aliasName=#{alias_name}")
|
592
|
+
out_file.puts("aliasPassword=#{alias_password}")
|
593
|
+
out_file.close
|
594
|
+
|
595
|
+
self.encrypt_file(properties_path, properties_encrypt_path, key_path, false)
|
596
|
+
File.delete(properties_path)
|
597
|
+
|
598
|
+
# Print Keystore data in repo:
|
599
|
+
keystore_info_path = File.join(keystoreAppDir, keystore_info_name)
|
600
|
+
`yes "" | keytool -list -v -keystore '#{keystore_path}' -storepass '#{key_password}' > '#{keystore_info_path}'`
|
601
|
+
|
602
|
+
UI.message("Upload new Keystore to remote repository...")
|
603
|
+
puts ''
|
604
|
+
`cd '#{repo_dir}' && git add .`
|
605
|
+
`cd '#{repo_dir}' && git commit -m "[ADD] Keystore for app '#{package_name}'."`
|
606
|
+
`cd '#{repo_dir}' && git push`
|
607
|
+
puts ''
|
608
|
+
|
609
|
+
else
|
610
|
+
UI.message "Keystore file already exists, continue..."
|
611
|
+
|
612
|
+
self.decrypt_file(properties_encrypt_path, properties_path, key_path, false)
|
613
|
+
|
614
|
+
properties = self.load_properties(properties_path)
|
615
|
+
# Pry::ColorPrinter.pp(properties)
|
616
|
+
key_password = properties['keyPassword']
|
617
|
+
alias_name = properties['aliasName']
|
618
|
+
alias_password = properties['aliasPassword']
|
619
|
+
|
620
|
+
File.delete(properties_path)
|
621
|
+
end
|
622
|
+
|
623
|
+
# Sign APK:
|
624
|
+
if apk_path && File.file?(apk_path)
|
625
|
+
UI.message("APK to sign: " + apk_path)
|
626
|
+
|
627
|
+
# Resolve path to the APK to sign:
|
628
|
+
output_signed_apk = ''
|
629
|
+
apk_path = self.resolve_apk_path(apk_path)
|
630
|
+
|
631
|
+
if File.file?(keystore_path)
|
632
|
+
|
633
|
+
UI.message("Signing the APK...")
|
634
|
+
puts ''
|
635
|
+
output_signed_apk = self.sign_apk(
|
636
|
+
apk_path,
|
637
|
+
keystore_path,
|
638
|
+
key_password,
|
639
|
+
alias_name,
|
640
|
+
alias_password,
|
641
|
+
zip_align, # Zip align
|
642
|
+
build_tools_version # Buil-tools version
|
643
|
+
)
|
644
|
+
puts ''
|
645
|
+
end
|
646
|
+
|
647
|
+
# Prepare contect shared values for next lanes:
|
648
|
+
Actions.lane_context[SharedValues::MATCH_ANDROID_PATH] = keystore_path
|
649
|
+
Actions.lane_context[SharedValues::MATCH_ANDROID_ALIAS_NAME] = alias_name
|
650
|
+
Actions.lane_context[SharedValues::MATCH_ANDROID_APK_SIGNED] = output_signed_apk
|
651
|
+
|
652
|
+
output_signed_apk
|
653
|
+
# Sign AAB
|
654
|
+
elsif aab_path && File.file?(aab_path)
|
655
|
+
UI.message('AAB to sign: '+ aab_path)
|
656
|
+
|
657
|
+
# Resolve path to the AAB to sign:
|
658
|
+
output_signed_aab = ''
|
659
|
+
aab_path = self.resolve_aab_path(aab_path)
|
660
|
+
|
661
|
+
if File.file?(keystore_path)
|
662
|
+
|
663
|
+
UI.message("Signing the AAB...")
|
664
|
+
puts ''
|
665
|
+
output_signed_aab = self.sign_aab(
|
666
|
+
aab_path,
|
667
|
+
keystore_path,
|
668
|
+
key_password,
|
669
|
+
alias_name,
|
670
|
+
alias_password
|
671
|
+
)
|
672
|
+
puts ''
|
673
|
+
end
|
674
|
+
|
675
|
+
# Prepare contect shared values for next lanes:
|
676
|
+
Actions.lane_context[SharedValues::MATCH_ANDROID_PATH] = keystore_path
|
677
|
+
Actions.lane_context[SharedValues::MATCH_ANDROID_ALIAS_NAME] = alias_name
|
678
|
+
Actions.lane_context[SharedValues::MATCH_ANDROID_AAB_SIGNED] = output_signed_aab
|
679
|
+
|
680
|
+
output_signed_aab
|
681
|
+
else
|
682
|
+
UI.message("No APK or AAB file found")
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
def self.description
|
687
|
+
"Easily sync your Android keystores across your team"
|
688
|
+
end
|
689
|
+
|
690
|
+
def self.authors
|
691
|
+
["Christopher NEY", "Simon Scherzinger"]
|
692
|
+
end
|
693
|
+
|
694
|
+
def self.return_value
|
695
|
+
"Prepare Keystore local path, alias name, and passwords for the specified App."
|
696
|
+
end
|
697
|
+
|
698
|
+
def self.output
|
699
|
+
[
|
700
|
+
['MATCH_ANDROID_PATH', 'File path of the Keystore fot the App.'],
|
701
|
+
['MATCH_ANDROID_ALIAS_NAME', 'Keystore Alias Name.'],
|
702
|
+
['MATCH_ANDROID_APK_SIGNED', 'Path of the signed APK.'],
|
703
|
+
['MATCH_ANDROID_AAB_SIGNED', 'Path of the signed AAB.']
|
704
|
+
]
|
705
|
+
end
|
706
|
+
|
707
|
+
def self.details
|
708
|
+
# Optional:
|
709
|
+
"This way, your entire team can use the same account and have one code signing identity without any manual work or confusion."
|
710
|
+
end
|
711
|
+
|
712
|
+
def self.available_options
|
713
|
+
[
|
714
|
+
FastlaneCore::ConfigItem.new(key: :git_url,
|
715
|
+
env_name: "MATCH_ANDROID_GIT_URL",
|
716
|
+
description: "The URL of the Git repository (Github, BitBucket...)",
|
717
|
+
optional: false,
|
718
|
+
type: String),
|
719
|
+
FastlaneCore::ConfigItem.new(key: :package_name,
|
720
|
+
env_name: "MATCH_ANDROID_PACKAGE_NAME",
|
721
|
+
description: "The package name of the App",
|
722
|
+
optional: false,
|
723
|
+
type: String),
|
724
|
+
FastlaneCore::ConfigItem.new(key: :apk_path,
|
725
|
+
env_name: "MATCH_ANDROID_APK_PATH",
|
726
|
+
description: "Path of the APK file to sign",
|
727
|
+
optional: true,
|
728
|
+
type: String),
|
729
|
+
FastlaneCore::ConfigItem.new(key: :aab_path,
|
730
|
+
env_name: "MATCH_ANDROID_AAB_PATH",
|
731
|
+
description: "Path of the AAB file to sign",
|
732
|
+
optional: true,
|
733
|
+
type: String),
|
734
|
+
FastlaneCore::ConfigItem.new(key: :match_secret,
|
735
|
+
env_name: "MATCH_ANDROID_SECRET",
|
736
|
+
description: "Secret to decrypt keystore.properties file (CI)",
|
737
|
+
optional: true,
|
738
|
+
type: String),
|
739
|
+
FastlaneCore::ConfigItem.new(key: :existing_keystore,
|
740
|
+
env_name: "MATCH_ANDROID_EXISTING",
|
741
|
+
description: "Path of an existing Keystore",
|
742
|
+
optional: true,
|
743
|
+
type: String),
|
744
|
+
FastlaneCore::ConfigItem.new(key: :override_keystore,
|
745
|
+
env_name: "MATCH_ANDROID_OVERRIDE",
|
746
|
+
description: "Override an existing Keystore (false by default)",
|
747
|
+
optional: true,
|
748
|
+
type: Boolean),
|
749
|
+
FastlaneCore::ConfigItem.new(key: :keystore_data,
|
750
|
+
env_name: "MATCH_ANDROID_JSON_PATH",
|
751
|
+
description: "Required data to import an existing keystore, or create a new one",
|
752
|
+
optional: true,
|
753
|
+
type: String),
|
754
|
+
FastlaneCore::ConfigItem.new(key: :build_tools_version,
|
755
|
+
env_name: "MATCH_ANDROID_BUILD_TOOLS_VERSION",
|
756
|
+
description: "Set built-tools version (by default latest available on machine)",
|
757
|
+
optional: true,
|
758
|
+
type: String),
|
759
|
+
FastlaneCore::ConfigItem.new(key: :zip_align,
|
760
|
+
env_name: "MATCH_ANDROID_ZIPALIGN",
|
761
|
+
description: "Define if plugin will run zipalign on APK before sign it (true by default)",
|
762
|
+
optional: true,
|
763
|
+
type: Boolean),
|
764
|
+
FastlaneCore::ConfigItem.new(key: :compat_key,
|
765
|
+
env_name: "MATCH_ANDROID_COMPAT_KEY",
|
766
|
+
description: "Define the compatibility key version used on local machine (nil by default)",
|
767
|
+
optional: true,
|
768
|
+
type: String),
|
769
|
+
FastlaneCore::ConfigItem.new(key: :clear_keystore,
|
770
|
+
env_name: "MATCH_ANDROID_CLEAR",
|
771
|
+
description: "Clear the local keystore (false by default)",
|
772
|
+
optional: true,
|
773
|
+
type: Boolean),
|
774
|
+
FastlaneCore::ConfigItem.new(key: :unit_test,
|
775
|
+
env_name: "MATCH_ANDROID_UNIT_TESTS",
|
776
|
+
description: "launch Unit Tests (false by default)",
|
777
|
+
optional: true,
|
778
|
+
type: Boolean)
|
779
|
+
]
|
780
|
+
end
|
781
|
+
|
782
|
+
def self.is_supported?(platform)
|
783
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
784
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
785
|
+
[:android].include?(platform)
|
786
|
+
end
|
787
|
+
end
|
788
|
+
end
|
789
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class MatchKeystoreHelper
|
8
|
+
# class methods that you define here become available in your action
|
9
|
+
# as `Helper::MatchKeystoreHelper.your_method`
|
10
|
+
#
|
11
|
+
def self.show_message
|
12
|
+
UI.message("Hello from the match_android plugin helper!")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/match_android/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module MatchKeystore
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::MatchKeystore.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-match_android
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Maikel Stuivenberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-05-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-require_tools
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fastlane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.144.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.144.0
|
139
|
+
description:
|
140
|
+
email: maikel.stuivenberg@gmail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- lib/fastlane/plugin/match_android.rb
|
148
|
+
- lib/fastlane/plugin/match_android/actions/match_android_action.rb
|
149
|
+
- lib/fastlane/plugin/match_android/helper/match_android_helper.rb
|
150
|
+
- lib/fastlane/plugin/match_android/version.rb
|
151
|
+
homepage: https://github.com/maikelstuivenberg/fastlane-plugin-match_android
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata: {}
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubygems_version: 3.5.9
|
171
|
+
signing_key:
|
172
|
+
specification_version: 4
|
173
|
+
summary: Share your Android keystore with your team in a secure way
|
174
|
+
test_files: []
|