fastlane-plugin-polidea 4.0.0.pre.1 → 4.0.0.pre.2
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: 4e2ee09858b7d15d9d1e20e771a581f3170f7e4191bad099ccbc1373e72a42d7
|
4
|
+
data.tar.gz: 9e2dc19d68fad43c20f10d257d0cf3e80b91bebcbd78c41354a9c83e7c4dc082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2529b7020640f17bf821dacbd9228244096095cd26b83cc9a2ec4c202adedc198f30cb57967232b3597ffdf227c2ae2768a88db293f053d40c0089996539588
|
7
|
+
data.tar.gz: de13493b3b7647d979e83944af408add14ca67570cb0f5ba4ddad16a381246e2cbc59eb223d0572d21c164bc1d4a3fa135ba6357a69b96bb5bead933513538d5
|
data/README.md
CHANGED
@@ -17,8 +17,6 @@ fastlane add_plugin polidea
|
|
17
17
|
Plugin contains following actions:
|
18
18
|
- `extract_app_info`: Extracts application name, icon, version, binary size from .apk/.ipa
|
19
19
|
- `release_notes`: Extracts release notes from git tag message
|
20
|
-
- `fota_s3`: Custom version of s3 action with Polidea's installation page
|
21
|
-
- `fota_mail`: Custom version of mailgun action with Polidea's mail template
|
22
20
|
- `shuttle`: Upload new app to Shuttle
|
23
21
|
|
24
22
|
See more details [here](./docs/Actions.md).
|
@@ -33,10 +31,7 @@ fastlane actions
|
|
33
31
|
lane :deploy do
|
34
32
|
(some actions that produces .ipa/.apk)
|
35
33
|
extract_app_info
|
36
|
-
|
37
|
-
fota_mail(
|
38
|
-
to: "hey@polidea.com"
|
39
|
-
)
|
34
|
+
shuttle
|
40
35
|
end
|
41
36
|
```
|
42
37
|
|
@@ -10,6 +10,10 @@ module Fastlane
|
|
10
10
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
|
11
11
|
options = {
|
12
12
|
api_token: params[:api_token],
|
13
|
+
ipa: params[:ipa],
|
14
|
+
apk: params[:apk],
|
15
|
+
dsym: params[:dsym],
|
16
|
+
mapping: params[:mapping],
|
13
17
|
prefix_schema: params[:prefix_schema],
|
14
18
|
app_identifier: params[:app_identifier],
|
15
19
|
app_version: params[:app_version],
|
@@ -21,7 +25,9 @@ module Fastlane
|
|
21
25
|
}
|
22
26
|
validate(platform, options)
|
23
27
|
config = get_config(platform, options)
|
24
|
-
|
28
|
+
client = Shuttle::Client.new(base_url(params[:environment]), params[:api_token])
|
29
|
+
notify(client, platform, config)
|
30
|
+
upload(client, platform, config)
|
25
31
|
|
26
32
|
UI.success("Successfully uploaded to #{params[:app_identifier]} #{params[:app_version]}.#{params[:build_number]} to Shuttle")
|
27
33
|
|
@@ -52,6 +58,26 @@ module Fastlane
|
|
52
58
|
verify_block: proc do |api_token|
|
53
59
|
UI.user_error!("No API token for Shuttle given, pass using `api_token: 'token'`") unless api_token and !api_token.empty?
|
54
60
|
end),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :ipa,
|
62
|
+
env_name: "",
|
63
|
+
description: ".ipa file for the build",
|
64
|
+
optional: true,
|
65
|
+
default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]),
|
66
|
+
FastlaneCore::ConfigItem.new(key: :dsym,
|
67
|
+
env_name: "",
|
68
|
+
description: "zipped .dsym package for the build",
|
69
|
+
optional: true,
|
70
|
+
default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH]),
|
71
|
+
FastlaneCore::ConfigItem.new(key: :apk,
|
72
|
+
env_name: "",
|
73
|
+
description: ".apk file for the build",
|
74
|
+
optional: true,
|
75
|
+
default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]),
|
76
|
+
FastlaneCore::ConfigItem.new(key: :mapping,
|
77
|
+
env_name: "",
|
78
|
+
description: "The path to the mapping.txt file",
|
79
|
+
optional: true,
|
80
|
+
default_value: Actions.lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH]),
|
55
81
|
FastlaneCore::ConfigItem.new(key: :prefix_schema,
|
56
82
|
env_name: "SHUTTLE_PREFIX_SCHEMA",
|
57
83
|
description: "Prefix schema in uploaded app",
|
@@ -105,6 +131,11 @@ module Fastlane
|
|
105
131
|
when :ios
|
106
132
|
url_scheme = params[:prefix_schema]
|
107
133
|
UI.user_error!("No prefix scheme given. Make sure `add_prefix_schema` action succeded before build action") if url_scheme.nil?
|
134
|
+
ipa = params[:ipa]
|
135
|
+
UI.user_error!("No .ipa file path given. Make sure `gym` action succeded") if ipa.nil?
|
136
|
+
when :android
|
137
|
+
apk = params[:apk]
|
138
|
+
UI.user_error!("No .apk file path given. Make sure `gradle` action succeded") if apk.nil?
|
108
139
|
end
|
109
140
|
end
|
110
141
|
|
@@ -118,8 +149,13 @@ module Fastlane
|
|
118
149
|
releaser = params[:releaser] || commit_author
|
119
150
|
|
120
151
|
case platform
|
152
|
+
when :android
|
153
|
+
apk = params[:apk]
|
154
|
+
mapping = params[:mapping]
|
121
155
|
when :ios
|
122
156
|
prefix_schema = params[:prefix_schema]
|
157
|
+
ipa = params[:ipa]
|
158
|
+
dsym = params[:dsym]
|
123
159
|
end
|
124
160
|
|
125
161
|
{
|
@@ -131,11 +167,15 @@ module Fastlane
|
|
131
167
|
releaser: releaser,
|
132
168
|
binary_size: binary_size,
|
133
169
|
prefix_schema: prefix_schema,
|
134
|
-
environment: params[:environment]
|
170
|
+
environment: params[:environment],
|
171
|
+
ipa: ipa,
|
172
|
+
apk: apk,
|
173
|
+
mapping: mapping,
|
174
|
+
dsym: dsym
|
135
175
|
}
|
136
176
|
end
|
137
177
|
|
138
|
-
def self.notify(platform, params)
|
178
|
+
def self.notify(client, platform, params)
|
139
179
|
build = {
|
140
180
|
version: params[:app_version],
|
141
181
|
releaseNotes: params[:release_notes],
|
@@ -146,12 +186,40 @@ module Fastlane
|
|
146
186
|
build[:prefixSchema] = params[:prefix_schema] if platform == :ios
|
147
187
|
build[:versionCode] = params[:build_number] if platform == :android
|
148
188
|
|
149
|
-
client = Shuttle::Client.new(base_url(params[:environment]), params[:api_token])
|
150
|
-
|
151
189
|
client.create_build(platform, params[:app_identifier], build)
|
152
190
|
end
|
153
191
|
private_class_method :notify
|
154
192
|
|
193
|
+
def self.upload(client, platform, params)
|
194
|
+
case platform
|
195
|
+
when :ios
|
196
|
+
upload_urls = client.get_upload_urls(platform, params[:app_identifier], params[:prefix_schema])
|
197
|
+
upload_build_url = upload_urls['buildUrl']
|
198
|
+
self.upload_file(upload_build_url, params[:ipa])
|
199
|
+
UI.success("Successfully uploaded ipa file")
|
200
|
+
if params[:dsym]
|
201
|
+
upload_dsym_url = upload_urls['debugFileUrl']
|
202
|
+
self.upload_file(upload_dsym_url, params[:dsym])
|
203
|
+
UI.success("Successfully uploaded dsym file")
|
204
|
+
end
|
205
|
+
when :android
|
206
|
+
upload_urls = client.get_upload_urls(platform, params[:app_identifier], params[:build_number])
|
207
|
+
upload_build_url = upload_urls['buildUrl']
|
208
|
+
self.upload_file(upload_build_url, params[:apk])
|
209
|
+
UI.success("Successfully uploaded apk file")
|
210
|
+
if params[:mapping]
|
211
|
+
upload_mapping_file_url = upload_urls['debugFileUrl']
|
212
|
+
self.upload_file(upload_mapping_file_url, params[:mapping])
|
213
|
+
UI.success("Successfully uploaded mapping file")
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
def self.upload_file(url, build)
|
219
|
+
client = S3::Client.new
|
220
|
+
client.upload_file(url, build)
|
221
|
+
end
|
222
|
+
|
155
223
|
def self.base_url(environment)
|
156
224
|
case environment
|
157
225
|
when :production
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-polidea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.pre.
|
4
|
+
version: 4.0.0.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotrek Dubiel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -265,8 +265,6 @@ files:
|
|
265
265
|
- lib/fastlane/plugin/polidea.rb
|
266
266
|
- lib/fastlane/plugin/polidea/actions/add_prefix_schema.rb
|
267
267
|
- lib/fastlane/plugin/polidea/actions/extract_app_info.rb
|
268
|
-
- lib/fastlane/plugin/polidea/actions/fota_mail.rb
|
269
|
-
- lib/fastlane/plugin/polidea/actions/fota_s3.rb
|
270
268
|
- lib/fastlane/plugin/polidea/actions/import_provisioning.rb
|
271
269
|
- lib/fastlane/plugin/polidea/actions/release_notes.rb
|
272
270
|
- lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
|
@@ -1,187 +0,0 @@
|
|
1
|
-
require 'redcarpet'
|
2
|
-
require 'fastlane/erb_template_helper'
|
3
|
-
|
4
|
-
module Fastlane
|
5
|
-
module Actions
|
6
|
-
class FotaMailAction < Action
|
7
|
-
def self.is_supported?(platform)
|
8
|
-
true
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.run(options)
|
12
|
-
Fastlane::Polidea.session.action_launched("fota_mail", options)
|
13
|
-
|
14
|
-
Actions.verify_gem!('premailer')
|
15
|
-
require 'premailer'
|
16
|
-
inline_images(options)
|
17
|
-
mailgunit(options)
|
18
|
-
|
19
|
-
Fastlane::Polidea.session.action_completed("fota_mail")
|
20
|
-
UI.success "Mail sent!"
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.description
|
24
|
-
"Send a success/error message to an email group"
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.available_options
|
28
|
-
[
|
29
|
-
FastlaneCore::ConfigItem.new(key: :postmaster,
|
30
|
-
env_name: "MAILGUN_SANDBOX_POSTMASTER",
|
31
|
-
description: "Mailgun sandbox domain postmaster for your mail"),
|
32
|
-
FastlaneCore::ConfigItem.new(key: :apikey,
|
33
|
-
env_name: "MAILGUN_APIKEY",
|
34
|
-
description: "Mailgun apikey for your mail"),
|
35
|
-
FastlaneCore::ConfigItem.new(key: :to,
|
36
|
-
env_name: "MAILGUN_TO",
|
37
|
-
description: "Destination of your mail"),
|
38
|
-
FastlaneCore::ConfigItem.new(key: :from,
|
39
|
-
env_name: "MAILGUN_FROM",
|
40
|
-
optional: true,
|
41
|
-
description: "Mailgun sender name",
|
42
|
-
default_value: "Polidea"),
|
43
|
-
FastlaneCore::ConfigItem.new(key: :success,
|
44
|
-
env_name: "MAILGUN_SUCCESS",
|
45
|
-
description: "Was this build successful? (true/false)",
|
46
|
-
optional: true,
|
47
|
-
default_value: true,
|
48
|
-
is_string: false),
|
49
|
-
FastlaneCore::ConfigItem.new(key: :ci_build_link,
|
50
|
-
env_name: "MAILGUN_CI_BUILD_LINK",
|
51
|
-
description: "CI Build Link",
|
52
|
-
optional: true,
|
53
|
-
is_string: true),
|
54
|
-
FastlaneCore::ConfigItem.new(key: :template_path,
|
55
|
-
env_name: "MAILGUN_TEMPLATE_PATH",
|
56
|
-
description: "Mail HTML template",
|
57
|
-
optional: true,
|
58
|
-
is_string: true),
|
59
|
-
FastlaneCore::ConfigItem.new(key: :platform,
|
60
|
-
env_name: "MAILGUN_PLATFORM",
|
61
|
-
description: "Platform used in mail template",
|
62
|
-
optional: true,
|
63
|
-
default_value: Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]),
|
64
|
-
FastlaneCore::ConfigItem.new(key: :app_icon,
|
65
|
-
env_name: "MAILGUN_APP_ICON",
|
66
|
-
description: "Path to app icon file",
|
67
|
-
is_string: true,
|
68
|
-
optional: true,
|
69
|
-
default_value: Actions.lane_context[SharedValues::ICON_OUTPUT_PATH]),
|
70
|
-
FastlaneCore::ConfigItem.new(key: :app_name,
|
71
|
-
env_name: "MAILGUN_APP_NAME",
|
72
|
-
description: "Application name",
|
73
|
-
is_string: true,
|
74
|
-
default_value: Actions.lane_context[SharedValues::APP_NAME]),
|
75
|
-
FastlaneCore::ConfigItem.new(key: :app_version,
|
76
|
-
env_name: "MAILGUN_APP_VERSION",
|
77
|
-
description: "Application version",
|
78
|
-
is_string: true,
|
79
|
-
default_value: Actions.lane_context[SharedValues::APP_VERSION]),
|
80
|
-
FastlaneCore::ConfigItem.new(key: :build_number,
|
81
|
-
env_name: "MAILGUN_BUILD_NUMBER",
|
82
|
-
description: "Build number",
|
83
|
-
default_value: Actions.lane_context[SharedValues::BUILD_NUMBER]),
|
84
|
-
FastlaneCore::ConfigItem.new(key: :installation_link,
|
85
|
-
env_name: "MAILGUN_INSTALLATION_LINK",
|
86
|
-
description: "Link to installation page",
|
87
|
-
is_string: true,
|
88
|
-
default_value: Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH]),
|
89
|
-
FastlaneCore::ConfigItem.new(key: :release_notes,
|
90
|
-
env_name: "MAILGUN_RELEASE_NOTES",
|
91
|
-
description: "Release notes",
|
92
|
-
type: String,
|
93
|
-
optional: true,
|
94
|
-
default_value: Actions.lane_context[SharedValues::RELEASE_NOTES]),
|
95
|
-
FastlaneCore::ConfigItem.new(key: :binary_size,
|
96
|
-
env_name: "MAILGUN_BINARY_SIZE",
|
97
|
-
description: "Binary size",
|
98
|
-
type: Integer,
|
99
|
-
default_value: Actions.lane_context[SharedValues::BINARY_SIZE]),
|
100
|
-
FastlaneCore::ConfigItem.new(key: :inline,
|
101
|
-
type: Array,
|
102
|
-
optional: true,
|
103
|
-
default_value: [])
|
104
|
-
]
|
105
|
-
end
|
106
|
-
|
107
|
-
def self.author
|
108
|
-
"thiagolioy"
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.inline_images(options)
|
112
|
-
options[:inline] = [
|
113
|
-
qr_code(options[:installation_link])
|
114
|
-
]
|
115
|
-
options[:inline] << File.new(options[:app_icon]) if options[:app_icon]
|
116
|
-
end
|
117
|
-
|
118
|
-
def self.qr_code(installation_link)
|
119
|
-
qr_code_path = "/tmp/qr_code.png"
|
120
|
-
QRGenerator.new(installation_link, ::ChunkyPNG::Color.rgb(21, 18, 126)).generate(qr_code_path)
|
121
|
-
File.new(qr_code_path)
|
122
|
-
end
|
123
|
-
|
124
|
-
def self.mailgunit(options)
|
125
|
-
sandbox_domain = options[:postmaster].split("@").last
|
126
|
-
body = mail_template(options)
|
127
|
-
|
128
|
-
sh """curl -s --user 'api:#{options[:apikey]}' \
|
129
|
-
https://api.mailgun.net/v3/#{sandbox_domain}/messages \
|
130
|
-
-F from='#{options[:from]} <#{options[:postmaster]}>' \
|
131
|
-
-F to='#{options[:to]}' \
|
132
|
-
-F subject='#{options[:app_name]} #{options[:app_version]} (#{options[:build_number]}) for #{human_platform(options[:platform])} is ready to install' \
|
133
|
-
--form-string html=#{Shellwords.escape(body)} \ """ + options[:inline].map { |file| "-F inline=@#{file.path}" }.join(" "), print_command: false, print_command_output: false
|
134
|
-
|
135
|
-
return body
|
136
|
-
end
|
137
|
-
|
138
|
-
def self.mail_template(options)
|
139
|
-
hash = {
|
140
|
-
author: Actions.git_author_email,
|
141
|
-
last_commit: Actions.last_git_commit_message,
|
142
|
-
is_android: options[:platform] == :android,
|
143
|
-
app_icon: options[:app_icon] ? File.basename(options[:app_icon]) : nil,
|
144
|
-
app_name: options[:app_name],
|
145
|
-
app_version: options[:app_version],
|
146
|
-
build_number: options[:build_number],
|
147
|
-
installation_link: options[:installation_link],
|
148
|
-
release_notes: options[:release_notes],
|
149
|
-
platform: options[:platform],
|
150
|
-
release_date: DateTime.now.strftime('%b %d, %Y'),
|
151
|
-
binary_size: (options[:binary_size] / 1024.0 / 1024.0).round(2).to_s,
|
152
|
-
qr_code: "qr_code.png"
|
153
|
-
}
|
154
|
-
hash[:success] = options[:success]
|
155
|
-
hash[:ci_build_link] = options[:ci_build_link]
|
156
|
-
|
157
|
-
# create html from template
|
158
|
-
html_template_path = options[:template_path]
|
159
|
-
if html_template_path && File.exist?(html_template_path)
|
160
|
-
eth = Fastlane::ErbTemplateHelper
|
161
|
-
html_template = eth.load_from_path(html_template_path)
|
162
|
-
mail_html = eth.render(html_template, hash)
|
163
|
-
else
|
164
|
-
mail_html = PageGenerator.mail(hash)
|
165
|
-
end
|
166
|
-
|
167
|
-
premailer = Premailer.new(
|
168
|
-
mail_html,
|
169
|
-
{ warn_level: Premailer::Warnings::SAFE, with_html_string: true }
|
170
|
-
)
|
171
|
-
premailer.to_inline_css
|
172
|
-
end
|
173
|
-
|
174
|
-
def self.human_platform(platform)
|
175
|
-
case platform
|
176
|
-
when :ios
|
177
|
-
"iOS"
|
178
|
-
when :android
|
179
|
-
"Android"
|
180
|
-
else
|
181
|
-
platform.to_s
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
# rubocop:enable Metrics/MethodLength
|
@@ -1,208 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'fastlane/erb_template_helper'
|
3
|
-
require 'ostruct'
|
4
|
-
require 'securerandom'
|
5
|
-
|
6
|
-
module Fastlane
|
7
|
-
module Actions
|
8
|
-
module SharedValues
|
9
|
-
S3_IPA_OUTPUT_PATH = :S3_IPA_OUTPUT_PATH
|
10
|
-
S3_DSYM_OUTPUT_PATH = :S3_DSYM_OUTPUT_PATH
|
11
|
-
S3_APK_OUTPUT_PATH = :S3_APK_OUTPUT_PATH
|
12
|
-
S3_MAPPING_OUTPUT_PATH = :S3_MAPPING_OUTPUT_PATH
|
13
|
-
end
|
14
|
-
|
15
|
-
class FotaS3Action < Action
|
16
|
-
def self.run(config)
|
17
|
-
Fastlane::Polidea.session.action_launched("fota_s3", config)
|
18
|
-
|
19
|
-
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
|
20
|
-
|
21
|
-
# Calling fetch on config so that default values will be used
|
22
|
-
params = {}
|
23
|
-
params[:ipa] = config[:ipa]
|
24
|
-
params[:apk] = config[:apk]
|
25
|
-
params[:dsym] = config[:dsym]
|
26
|
-
params[:mapping] = config[:mapping]
|
27
|
-
params[:environment] = config[:environment]
|
28
|
-
params[:api_token] = config[:api_token]
|
29
|
-
params[:app_identifier] = config[:app_identifier]
|
30
|
-
params[:prefix_schema] = config[:prefix_schema]
|
31
|
-
params[:build_number] = config[:build_number]
|
32
|
-
|
33
|
-
shuttle_client = Shuttle::Client.new(base_url(params[:environment]), params[:api_token])
|
34
|
-
|
35
|
-
case platform
|
36
|
-
when :ios
|
37
|
-
upload_ios(params, shuttle_client)
|
38
|
-
when :android
|
39
|
-
upload_android(params, shuttle_client)
|
40
|
-
end
|
41
|
-
|
42
|
-
Fastlane::Polidea.session.action_completed("fota_s3")
|
43
|
-
return true
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.upload_ios(params, shuttle_client)
|
47
|
-
# Pulling parameters for other uses
|
48
|
-
ipa_file = params[:ipa]
|
49
|
-
dsym_file = params[:dsym]
|
50
|
-
app_identifier = params[:app_identifier]
|
51
|
-
prefix_schema = params[:prefix_schema]
|
52
|
-
|
53
|
-
UI.user_error!("No IPA file path given, pass using `ipa: 'ipa path'`") unless ipa_file.to_s.length > 0
|
54
|
-
|
55
|
-
upload_urls = shuttle_client.get_upload_urls('ios', app_identifier, prefix_schema)
|
56
|
-
upload_build_url = upload_urls['buildUrl']
|
57
|
-
self.upload_file(upload_build_url, ipa_file)
|
58
|
-
|
59
|
-
# Setting action and environment variables
|
60
|
-
Actions.lane_context[SharedValues::S3_IPA_OUTPUT_PATH] = upload_build_url
|
61
|
-
ENV[SharedValues::S3_IPA_OUTPUT_PATH.to_s] = upload_build_url
|
62
|
-
|
63
|
-
if dsym_file
|
64
|
-
upload_dsym_url = upload_urls['debugFileUrl']
|
65
|
-
self.upload_file(upload_dsym_url, dsym_file)
|
66
|
-
end
|
67
|
-
|
68
|
-
UI.success("Successfully uploaded ipa file")
|
69
|
-
|
70
|
-
if upload_dsym_url
|
71
|
-
Actions.lane_context[SharedValues::S3_DSYM_OUTPUT_PATH] = upload_dsym_url
|
72
|
-
ENV[SharedValues::S3_DSYM_OUTPUT_PATH.to_s] = upload_dsym_url
|
73
|
-
UI.success("Successfully uploaded dsym file")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def self.upload_android(params, shuttle_client)
|
78
|
-
# Pulling parameters for other uses
|
79
|
-
apk_file = params[:apk]
|
80
|
-
mapping_file = params[:mapping]
|
81
|
-
app_identifier = params[:app_identifier]
|
82
|
-
build_number = params[:build_number]
|
83
|
-
|
84
|
-
UI.user_error!("No APK file path given, pass using `apk: 'apk path'`") unless apk_file.to_s.length > 0
|
85
|
-
|
86
|
-
upload_urls = shuttle_client.get_upload_urls('android', app_identifier, build_number)
|
87
|
-
upload_build_url = upload_urls['buildUrl']
|
88
|
-
self.upload_file(upload_build_url, apk_file)
|
89
|
-
|
90
|
-
# Setting action and environment variables
|
91
|
-
Actions.lane_context[SharedValues::S3_APK_OUTPUT_PATH] = upload_build_url
|
92
|
-
ENV[SharedValues::S3_APK_OUTPUT_PATH.to_s] = upload_build_url
|
93
|
-
|
94
|
-
if mapping_file
|
95
|
-
upload_mapping_file_url = upload_urls['debugFileUrl']
|
96
|
-
self.upload_file(upload_mapping_file_url, mapping_file)
|
97
|
-
|
98
|
-
# Setting action and environment variables
|
99
|
-
Actions.lane_context[SharedValues::S3_MAPPING_OUTPUT_PATH] = upload_mapping_file_url
|
100
|
-
ENV[SharedValues::S3_MAPPING_OUTPUT_PATH.to_s] = upload_mapping_file_url
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
UI.success("Successfully uploaded apk file")
|
105
|
-
|
106
|
-
if upload_mapping_file_url
|
107
|
-
UI.success("Successfully uploaded mapping file")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.upload_file(url, build)
|
112
|
-
client = S3::Client.new
|
113
|
-
client.upload_file(url, build)
|
114
|
-
end
|
115
|
-
|
116
|
-
def self.base_url(environment)
|
117
|
-
case environment
|
118
|
-
when :production
|
119
|
-
"https://shuttle.polidea.com"
|
120
|
-
when :testing
|
121
|
-
"https://shuttle-testing.polidea.com"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
private_class_method :base_url
|
125
|
-
|
126
|
-
def self.description
|
127
|
-
"Uploads build to AWS S3"
|
128
|
-
end
|
129
|
-
|
130
|
-
def self.available_options
|
131
|
-
[
|
132
|
-
FastlaneCore::ConfigItem.new(key: :ipa,
|
133
|
-
env_name: "",
|
134
|
-
description: ".ipa file for the build",
|
135
|
-
optional: true,
|
136
|
-
default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]),
|
137
|
-
FastlaneCore::ConfigItem.new(key: :dsym,
|
138
|
-
env_name: "",
|
139
|
-
description: "zipped .dsym package for the build",
|
140
|
-
optional: true,
|
141
|
-
default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH]),
|
142
|
-
FastlaneCore::ConfigItem.new(key: :apk,
|
143
|
-
env_name: "",
|
144
|
-
description: ".apk file for the build",
|
145
|
-
optional: true,
|
146
|
-
default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]),
|
147
|
-
FastlaneCore::ConfigItem.new(key: :mapping,
|
148
|
-
env_name: "",
|
149
|
-
description: "The path to the mapping.txt file",
|
150
|
-
optional: true,
|
151
|
-
default_value: Actions.lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH]),
|
152
|
-
FastlaneCore::ConfigItem.new(key: :treat_bucket_as_domain_name,
|
153
|
-
description: "If it's true, it transforms all urls from https://s3.amazonaws.com/BUCKET_NAME to https://BUCKET_NAME",
|
154
|
-
is_string: false,
|
155
|
-
optional: true,
|
156
|
-
default_value: true),
|
157
|
-
FastlaneCore::ConfigItem.new(key: :environment,
|
158
|
-
description: "Select environment, defaults to :production",
|
159
|
-
type: Symbol,
|
160
|
-
default_value: :production,
|
161
|
-
optional: true),
|
162
|
-
FastlaneCore::ConfigItem.new(key: :api_token,
|
163
|
-
env_name: "SHUTTLE_API_TOKEN",
|
164
|
-
description: "API Token for Shuttle",
|
165
|
-
verify_block: proc do |api_token|
|
166
|
-
UI.user_error!("No API token for Shuttle given, pass using `api_token: 'token'`") unless api_token and !api_token.empty?
|
167
|
-
end),
|
168
|
-
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
169
|
-
description: "App identifier, either bundle id or package name",
|
170
|
-
type: String,
|
171
|
-
default_value: Actions.lane_context[SharedValues::APP_IDENTIFIER]),
|
172
|
-
FastlaneCore::ConfigItem.new(key: :prefix_schema,
|
173
|
-
env_name: "SHUTTLE_PREFIX_SCHEMA",
|
174
|
-
description: "Prefix schema in uploaded app",
|
175
|
-
default_value: Actions.lane_context[SharedValues::PREFIX_SCHEMA],
|
176
|
-
optional: true),
|
177
|
-
FastlaneCore::ConfigItem.new(key: :build_number,
|
178
|
-
description: "Build number, eg. 1337",
|
179
|
-
is_string: false,
|
180
|
-
default_value: Actions.lane_context[SharedValues::BUILD_NUMBER],
|
181
|
-
verify_block: proc do |build_number|
|
182
|
-
UI.user_error!("No value found for 'build_number'") unless build_number and build_number.kind_of? Integer
|
183
|
-
end)
|
184
|
-
]
|
185
|
-
end
|
186
|
-
|
187
|
-
def self.output
|
188
|
-
[
|
189
|
-
['S3_IPA_OUTPUT_PATH', 'Direct HTTP link to the uploaded ipa file'],
|
190
|
-
['S3_DSYM_OUTPUT_PATH', 'Direct HTTP link to the uploaded dsym file'],
|
191
|
-
['S3_APK_OUTPUT_PATH', 'Direct HTTP link to the uploaded apk file'],
|
192
|
-
['S3_MAPPING_OUTPUT_PATH', 'Direct HTTP link to the uploaded mapping.txt file']
|
193
|
-
]
|
194
|
-
end
|
195
|
-
|
196
|
-
def self.author
|
197
|
-
"joshdholtz"
|
198
|
-
end
|
199
|
-
|
200
|
-
def self.is_supported?(platform)
|
201
|
-
[:ios, :android].include? platform
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
# rubocop:enable Metrics/AbcSize
|
207
|
-
# rubocop:enable Metrics/MethodLength
|
208
|
-
# rubocop:enable Metrics/ClassLength
|