fastlane 2.170.0 → 2.171.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +74 -74
- data/deliver/lib/deliver/app_screenshot.rb +5 -7
- data/deliver/lib/deliver/app_screenshot_validator.rb +108 -0
- data/deliver/lib/deliver/loader.rb +13 -29
- data/deliver/lib/deliver/upload_metadata.rb +2 -0
- data/{spaceship/lib/spaceship/connect_api/models/.app_data_usage_data_protection.rb.swp → fastlane/lib/fastlane/actions/.github_api.rb.swp} +0 -0
- data/fastlane/lib/fastlane/actions/.set_github_release.rb.swp +0 -0
- data/fastlane/lib/fastlane/actions/add_git_tag.rb +12 -3
- data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +5 -1
- data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +142 -0
- data/fastlane/lib/fastlane/actions/git_commit.rb +3 -3
- data/fastlane/lib/fastlane/actions/github_api.rb +14 -3
- data/fastlane/lib/fastlane/actions/nexus_upload.rb +1 -0
- data/fastlane/lib/fastlane/actions/pod_push.rb +9 -0
- data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +9 -1
- data/fastlane/lib/fastlane/actions/set_github_release.rb +21 -8
- data/fastlane/lib/fastlane/actions/slack.rb +4 -5
- data/fastlane/lib/fastlane/actions/spm.rb +2 -2
- data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +4 -2
- data/fastlane/lib/fastlane/version.rb +1 -1
- data/fastlane/swift/Deliverfile.swift +1 -1
- data/fastlane/swift/DeliverfileProtocol.swift +1 -1
- data/fastlane/swift/Fastlane.swift +66 -13
- data/fastlane/swift/Gymfile.swift +1 -1
- data/fastlane/swift/GymfileProtocol.swift +1 -1
- data/fastlane/swift/Matchfile.swift +1 -1
- data/fastlane/swift/MatchfileProtocol.swift +1 -1
- data/fastlane/swift/Precheckfile.swift +1 -1
- data/fastlane/swift/PrecheckfileProtocol.swift +5 -1
- data/fastlane/swift/Scanfile.swift +1 -1
- data/fastlane/swift/ScanfileProtocol.swift +5 -1
- data/fastlane/swift/Screengrabfile.swift +1 -1
- data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
- data/fastlane/swift/Snapshotfile.swift +1 -1
- data/fastlane/swift/SnapshotfileProtocol.swift +2 -2
- data/fastlane_core/lib/fastlane_core/helper.rb +1 -1
- data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -4
- data/match/lib/match/encryption/openssl.rb +4 -2
- data/match/lib/match/storage/git_storage.rb +14 -10
- data/precheck/lib/precheck/options.rb +6 -1
- data/precheck/lib/precheck/rule_processor.rb +1 -1
- data/precheck/lib/precheck/runner.rb +1 -1
- data/scan/lib/scan/options.rb +5 -0
- data/scan/lib/scan/slack_poster.rb +1 -0
- data/screengrab/lib/screengrab/runner.rb +2 -0
- data/sigh/lib/sigh/runner.rb +1 -1
- data/snapshot/lib/snapshot/options.rb +1 -1
- data/spaceship/lib/spaceship/connect_api/api_client.rb +1 -1
- data/spaceship/lib/spaceship/connect_api/models/app.rb +6 -0
- data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +5 -1
- data/spaceship/lib/spaceship/connect_api/response.rb +3 -1
- metadata +21 -18
Binary file
|
@@ -9,7 +9,10 @@ module Fastlane
|
|
9
9
|
if options[:tag]
|
10
10
|
tag = options[:tag]
|
11
11
|
elsif options[:build_number]
|
12
|
-
|
12
|
+
tag_components = [options[:grouping]]
|
13
|
+
tag_components << lane_name if options[:includes_lane]
|
14
|
+
tag_components << "#{options[:prefix]}#{options[:build_number]}#{options[:postfix]}"
|
15
|
+
tag = tag_components.join('/')
|
13
16
|
else
|
14
17
|
UI.user_error!("No value found for 'tag' or 'build_number'. At least one of them must be provided. Note that if you do specify a tag, all other arguments are ignored.")
|
15
18
|
end
|
@@ -34,14 +37,14 @@ module Fastlane
|
|
34
37
|
def self.details
|
35
38
|
list = <<-LIST.markdown_list
|
36
39
|
`grouping` is just to keep your tags organised under one 'folder', defaults to 'builds'
|
37
|
-
`lane` is the name of the current fastlane lane
|
40
|
+
`lane` is the name of the current fastlane lane, if chosen to be included via 'includes_lane' option, which defaults to 'true'
|
38
41
|
`prefix` is anything you want to stick in front of the version number, e.g. 'v'
|
39
42
|
`postfix` is anything you want to stick at the end of the version number, e.g. '-RC1'
|
40
43
|
`build_number` is the build number, which defaults to the value emitted by the `increment_build_number` action
|
41
44
|
LIST
|
42
45
|
|
43
46
|
[
|
44
|
-
"This will automatically tag your build with the following format: `<grouping>/<lane>/<prefix><build_number>`, where:".markdown_preserve_newlines,
|
47
|
+
"This will automatically tag your build with the following format: `<grouping>/<lane>/<prefix><build_number><postfix>`, where:".markdown_preserve_newlines,
|
45
48
|
list,
|
46
49
|
"For example, for build 1234 in the 'appstore' lane, it will tag the commit with `builds/appstore/1234`."
|
47
50
|
].join("\n")
|
@@ -57,6 +60,11 @@ module Fastlane
|
|
57
60
|
env_name: "FL_GIT_TAG_GROUPING",
|
58
61
|
description: "Is used to keep your tags organised under one 'folder'",
|
59
62
|
default_value: 'builds'),
|
63
|
+
FastlaneCore::ConfigItem.new(key: :includes_lane,
|
64
|
+
env_name: "FL_GIT_TAG_INCLUDES_LANE",
|
65
|
+
description: "Whether the current lane should be included in the tag and message composition, e.g. '<grouping>/<lane>/<prefix><build_number><postfix>'",
|
66
|
+
is_string: false,
|
67
|
+
default_value: true),
|
60
68
|
FastlaneCore::ConfigItem.new(key: :prefix,
|
61
69
|
env_name: "FL_GIT_TAG_PREFIX",
|
62
70
|
description: "Anything you want to put in front of the version number (e.g. 'v')",
|
@@ -102,6 +110,7 @@ module Fastlane
|
|
102
110
|
'add_git_tag # simple tag with default values',
|
103
111
|
'add_git_tag(
|
104
112
|
grouping: "fastlane-builds",
|
113
|
+
includes_lane: true,
|
105
114
|
prefix: "v",
|
106
115
|
postfix: "-RC1",
|
107
116
|
build_number: 123
|
@@ -218,7 +218,7 @@ fastlane pilot upload --verbose
|
|
218
218
|
|
219
219
|
## Firewall Issues
|
220
220
|
|
221
|
-
_pilot_ uses the iTunes Transporter to upload metadata and binaries. In case you are behind a firewall, you can specify a different transporter protocol from the command line using
|
221
|
+
_pilot_ uses the iTunes [Transporter](https://help.apple.com/itc/transporteruserguide/#/apdATD1E1288-D1E1A1303-D1E1288A1126) to upload metadata and binaries. In case you are behind a firewall, you can specify a different transporter protocol from the command line using
|
222
222
|
|
223
223
|
```no-highlight
|
224
224
|
DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS="-t DAV" pilot ...
|
@@ -231,6 +231,10 @@ ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t DAV"
|
|
231
231
|
pilot...
|
232
232
|
```
|
233
233
|
|
234
|
+
Note, however, that Apple recommends you don’t specify the `-t transport` and instead allow Transporter to use automatic transport discovery to determine the best transport mode for your packages. For this reason, if the `t` option is passed, we will raise a warning.
|
235
|
+
|
236
|
+
Also note that `-t` is not the only additional parameter that can be used. The string specified in the `DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS` environment variable will be forwarded to Transporter. For all the available options, check [Apple's Transporter User Guide](https://help.apple.com/itc/transporteruserguide/#/apdATD1E1288-D1E1A1303-D1E1288A1126).
|
237
|
+
|
234
238
|
## Credentials Issues
|
235
239
|
|
236
240
|
If your password contains special characters, _pilot_ may throw a confusing error saying your "Your Apple ID or password was entered incorrectly". The easiest way to fix this error is to change your password to something that **does not** contains special characters.
|
@@ -0,0 +1,142 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class DownloadAppPrivacyDetailsFromAppStoreAction < Action
|
4
|
+
DEFAULT_PATH = Fastlane::Helper.fastlane_enabled_folder_path
|
5
|
+
DEFAULT_FILE_NAME = "app_privacy_details.json"
|
6
|
+
|
7
|
+
def self.run(params)
|
8
|
+
require 'spaceship'
|
9
|
+
|
10
|
+
# Prompts select team if multiple teams and none specified
|
11
|
+
UI.message("Login to App Store Connect (#{params[:username]})")
|
12
|
+
Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
|
13
|
+
UI.message("Login successful")
|
14
|
+
|
15
|
+
# Get App
|
16
|
+
app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
|
17
|
+
unless app
|
18
|
+
UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
|
19
|
+
end
|
20
|
+
|
21
|
+
# Download usages and return a config
|
22
|
+
raw_usages = download_app_data_usages(params, app)
|
23
|
+
|
24
|
+
usages_config = []
|
25
|
+
if raw_usages.count == 1 && raw_usages.first.data_protection.id == Spaceship::ConnectAPI::AppDataUsageDataProtection::ID::DATA_NOT_COLLECTED
|
26
|
+
usages_config << {
|
27
|
+
"data_protections" => [Spaceship::ConnectAPI::AppDataUsageDataProtection::ID::DATA_NOT_COLLECTED]
|
28
|
+
}
|
29
|
+
else
|
30
|
+
grouped_usages = raw_usages.group_by do |usage|
|
31
|
+
usage.category.id
|
32
|
+
end
|
33
|
+
grouped_usages.sort_by(&:first).each do |key, usage_group|
|
34
|
+
purposes = usage_group.map(&:purpose).compact || []
|
35
|
+
data_protections = usage_group.map(&:data_protection).compact || []
|
36
|
+
usages_config << {
|
37
|
+
"category" => key,
|
38
|
+
"purposes" => purposes.map(&:id).sort.uniq,
|
39
|
+
"data_protections" => data_protections.map(&:id).sort.uniq
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Save to JSON file
|
45
|
+
json = JSON.pretty_generate(usages_config)
|
46
|
+
path = output_path(params)
|
47
|
+
|
48
|
+
UI.message("Writing file to #{path}")
|
49
|
+
File.write(path, json)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.output_path(params)
|
53
|
+
path = params[:output_json_path]
|
54
|
+
return File.absolute_path(path)
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.download_app_data_usages(params, app)
|
58
|
+
UI.message("Downloading App Data Usage")
|
59
|
+
|
60
|
+
# Delete all existing usages for new ones
|
61
|
+
Spaceship::ConnectAPI::AppDataUsage.all(app_id: app.id, includes: "category,grouping,purpose,dataProtection", limit: 500)
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.description
|
65
|
+
"Download App Privacy Details from an app in App Store Connect"
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.available_options
|
69
|
+
user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
|
70
|
+
user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
|
71
|
+
|
72
|
+
[
|
73
|
+
FastlaneCore::ConfigItem.new(key: :username,
|
74
|
+
env_name: "FASTLANE_USER",
|
75
|
+
description: "Your Apple ID Username for App Store Connect",
|
76
|
+
default_value: user,
|
77
|
+
default_value_dynamic: true),
|
78
|
+
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
79
|
+
env_name: "UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_APP_IDENTIFIER",
|
80
|
+
description: "The bundle identifier of your app",
|
81
|
+
code_gen_sensitive: true,
|
82
|
+
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),
|
83
|
+
default_value_dynamic: true),
|
84
|
+
FastlaneCore::ConfigItem.new(key: :team_id,
|
85
|
+
env_name: "FASTLANE_ITC_TEAM_ID",
|
86
|
+
description: "The ID of your App Store Connect team if you're in multiple teams",
|
87
|
+
optional: true,
|
88
|
+
is_string: false, # as we also allow integers, which we convert to strings anyway
|
89
|
+
code_gen_sensitive: true,
|
90
|
+
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id),
|
91
|
+
default_value_dynamic: true),
|
92
|
+
FastlaneCore::ConfigItem.new(key: :team_name,
|
93
|
+
env_name: "FASTLANE_ITC_TEAM_NAME",
|
94
|
+
description: "The name of your App Store Connect team if you're in multiple teams",
|
95
|
+
optional: true,
|
96
|
+
code_gen_sensitive: true,
|
97
|
+
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name),
|
98
|
+
default_value_dynamic: true),
|
99
|
+
|
100
|
+
# JSON paths
|
101
|
+
FastlaneCore::ConfigItem.new(key: :output_json_path,
|
102
|
+
env_name: "UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_JSON_PATH",
|
103
|
+
description: "Path to the app usage data JSON file generated by interactive questions",
|
104
|
+
conflicting_options: [:skip_json_file_saving],
|
105
|
+
default_value: File.join(DEFAULT_PATH, DEFAULT_FILE_NAME))
|
106
|
+
]
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.author
|
110
|
+
"igor-makarov"
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.is_supported?(platform)
|
114
|
+
[:ios, :mac, :tvos].include?(platform)
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.details
|
118
|
+
"Download App Privacy Details from an app in App Store Connect. For more detail information, view https://docs.fastlane.tools/uploading-app-privacy-details"
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.example_code
|
122
|
+
[
|
123
|
+
'download_app_privacy_details_from_app_store(
|
124
|
+
username: "your@email.com",
|
125
|
+
team_name: "Your Team",
|
126
|
+
app_identifier: "com.your.bundle"
|
127
|
+
)',
|
128
|
+
'download_app_privacy_details_from_app_store(
|
129
|
+
username: "your@email.com",
|
130
|
+
team_name: "Your Team",
|
131
|
+
app_identifier: "com.your.bundle",
|
132
|
+
output_json_path: "fastlane/app_data_usages.json"
|
133
|
+
)'
|
134
|
+
]
|
135
|
+
end
|
136
|
+
|
137
|
+
def self.category
|
138
|
+
:production
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -11,9 +11,9 @@ module Fastlane
|
|
11
11
|
skip_git_hooks = params[:skip_git_hooks] ? '--no-verify' : ''
|
12
12
|
|
13
13
|
if params[:allow_nothing_to_commit]
|
14
|
-
|
15
|
-
UI.success("Nothing to commit
|
16
|
-
return if
|
14
|
+
nothing_staged = Actions.sh("git --no-pager diff --name-only --staged").empty?
|
15
|
+
UI.success("Nothing staged to commit ✅.") if nothing_staged
|
16
|
+
return if nothing_staged
|
17
17
|
end
|
18
18
|
|
19
19
|
command = "git commit -m #{params[:message].shellescape} #{paths} #{skip_git_hooks}".strip
|
@@ -13,7 +13,7 @@ module Fastlane
|
|
13
13
|
|
14
14
|
http_method = (params[:http_method] || 'GET').to_s.upcase
|
15
15
|
url = construct_url(params[:server_url], params[:path], params[:url])
|
16
|
-
headers = construct_headers(params[:api_token], params[:headers])
|
16
|
+
headers = construct_headers(params[:api_token], params[:api_bearer], params[:headers])
|
17
17
|
payload = construct_body(params[:body], params[:raw_body])
|
18
18
|
error_handlers = params[:error_handlers] || {}
|
19
19
|
secure = params[:secure]
|
@@ -89,12 +89,22 @@ module Fastlane
|
|
89
89
|
FastlaneCore::ConfigItem.new(key: :api_token,
|
90
90
|
env_name: "FL_GITHUB_API_TOKEN",
|
91
91
|
description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens",
|
92
|
+
conflicting_options: [:api_bearer],
|
92
93
|
sensitive: true,
|
93
94
|
code_gen_sensitive: true,
|
94
95
|
is_string: true,
|
95
96
|
default_value: ENV["GITHUB_API_TOKEN"],
|
96
97
|
default_value_dynamic: true,
|
97
|
-
optional:
|
98
|
+
optional: true),
|
99
|
+
FastlaneCore::ConfigItem.new(key: :api_bearer,
|
100
|
+
env_name: "FL_GITHUB_API_BEARER",
|
101
|
+
sensitive: true,
|
102
|
+
code_gen_sensitive: true,
|
103
|
+
is_string: true,
|
104
|
+
description: "Use a Bearer authorization token. Usually generated by Github Apps, e.g. GitHub Actions GITHUB_TOKEN environment variable",
|
105
|
+
conflicting_options: [:api_token],
|
106
|
+
optional: true,
|
107
|
+
default_value: nil),
|
98
108
|
FastlaneCore::ConfigItem.new(key: :http_method,
|
99
109
|
env_name: "FL_GITHUB_API_HTTP_METHOD",
|
100
110
|
description: "The HTTP method. e.g. GET / POST",
|
@@ -202,10 +212,11 @@ module Fastlane
|
|
202
212
|
|
203
213
|
private
|
204
214
|
|
205
|
-
def construct_headers(api_token, overrides)
|
215
|
+
def construct_headers(api_token, api_bearer, overrides)
|
206
216
|
require 'base64'
|
207
217
|
headers = { 'User-Agent' => 'fastlane-github_api' }
|
208
218
|
headers['Authorization'] = "Basic #{Base64.strict_encode64(api_token)}" if api_token
|
219
|
+
headers['Authorization'] = "Bearer #{api_bearer}" if api_bearer
|
209
220
|
headers.merge(overrides || {})
|
210
221
|
end
|
211
222
|
|
@@ -43,6 +43,10 @@ module Fastlane
|
|
43
43
|
command << "--skip-tests"
|
44
44
|
end
|
45
45
|
|
46
|
+
if params[:use_json]
|
47
|
+
command << "--use-json"
|
48
|
+
end
|
49
|
+
|
46
50
|
if params[:verbose]
|
47
51
|
command << "--verbose"
|
48
52
|
end
|
@@ -121,6 +125,11 @@ module Fastlane
|
|
121
125
|
optional: true,
|
122
126
|
type: Boolean,
|
123
127
|
env_name: "FL_POD_PUSH_SKIP_TESTS"),
|
128
|
+
FastlaneCore::ConfigItem.new(key: :use_json,
|
129
|
+
description: "Convert the podspec to JSON before pushing it to the repo",
|
130
|
+
optional: true,
|
131
|
+
type: Boolean,
|
132
|
+
env_name: "FL_POD_PUSH_USE_JSON"),
|
124
133
|
FastlaneCore::ConfigItem.new(key: :verbose,
|
125
134
|
description: "Show more debugging information",
|
126
135
|
optional: true,
|
@@ -32,6 +32,9 @@ module Fastlane
|
|
32
32
|
# optionally add the set-upstream component
|
33
33
|
command << '--set-upstream' if params[:set_upstream]
|
34
34
|
|
35
|
+
# optionally add the --push_options components
|
36
|
+
params[:push_options].each { |push_option| command << "--push-option=#{push_option}" }
|
37
|
+
|
35
38
|
# execute our command
|
36
39
|
Actions.sh('pwd')
|
37
40
|
return command.join(' ') if Helper.test?
|
@@ -84,7 +87,12 @@ module Fastlane
|
|
84
87
|
env_name: "FL_GIT_PUSH_USE_SET_UPSTREAM",
|
85
88
|
description: "Whether or not to use --set-upstream",
|
86
89
|
type: Boolean,
|
87
|
-
default_value: false)
|
90
|
+
default_value: false),
|
91
|
+
FastlaneCore::ConfigItem.new(key: :push_options,
|
92
|
+
env_name: "FL_GIT_PUSH_PUSH_OPTION",
|
93
|
+
description: "Array of strings to be passed using the '--push-option' option",
|
94
|
+
type: Array,
|
95
|
+
default_value: [])
|
88
96
|
]
|
89
97
|
end
|
90
98
|
|
@@ -13,6 +13,7 @@ module Fastlane
|
|
13
13
|
|
14
14
|
repo_name = params[:repository_name]
|
15
15
|
api_token = params[:api_token]
|
16
|
+
api_bearer = params[:api_bearer]
|
16
17
|
server_url = params[:server_url]
|
17
18
|
tag_name = params[:tag_name]
|
18
19
|
|
@@ -28,6 +29,7 @@ module Fastlane
|
|
28
29
|
GithubApiAction.run(
|
29
30
|
server_url: server_url,
|
30
31
|
api_token: api_token,
|
32
|
+
api_bearer: api_bearer,
|
31
33
|
http_method: 'POST',
|
32
34
|
path: "repos/#{repo_name}/releases",
|
33
35
|
body: payload,
|
@@ -65,12 +67,13 @@ module Fastlane
|
|
65
67
|
assets = params[:upload_assets]
|
66
68
|
if assets && assets.count > 0
|
67
69
|
# upload assets
|
68
|
-
self.upload_assets(assets, json['upload_url'], api_token)
|
70
|
+
self.upload_assets(assets, json['upload_url'], api_token, api_bearer)
|
69
71
|
|
70
72
|
# fetch the release again, so that it contains the uploaded assets
|
71
73
|
GithubApiAction.run(
|
72
74
|
server_url: server_url,
|
73
75
|
api_token: api_token,
|
76
|
+
api_bearer: api_bearer,
|
74
77
|
http_method: 'GET',
|
75
78
|
path: "repos/#{repo_name}/releases/#{release_id}",
|
76
79
|
error_handlers: {
|
@@ -90,13 +93,13 @@ module Fastlane
|
|
90
93
|
end
|
91
94
|
end
|
92
95
|
|
93
|
-
def self.upload_assets(assets, upload_url_template, api_token)
|
96
|
+
def self.upload_assets(assets, upload_url_template, api_token, api_bearer)
|
94
97
|
assets.each do |asset|
|
95
|
-
self.upload(asset, upload_url_template, api_token)
|
98
|
+
self.upload(asset, upload_url_template, api_token, api_bearer)
|
96
99
|
end
|
97
100
|
end
|
98
101
|
|
99
|
-
def self.upload(asset_path, upload_url_template, api_token)
|
102
|
+
def self.upload(asset_path, upload_url_template, api_token, api_bearer)
|
100
103
|
# if it's a directory, zip it first in a temp directory, because we can only upload binary files
|
101
104
|
absolute_path = File.absolute_path(asset_path)
|
102
105
|
|
@@ -107,14 +110,14 @@ module Fastlane
|
|
107
110
|
Dir.mktmpdir do |dir|
|
108
111
|
tmpzip = File.join(dir, File.basename(absolute_path) + '.zip')
|
109
112
|
sh("cd \"#{File.dirname(absolute_path)}\"; zip -r --symlinks \"#{tmpzip}\" \"#{File.basename(absolute_path)}\" 2>&1 >/dev/null")
|
110
|
-
self.upload_file(tmpzip, upload_url_template, api_token)
|
113
|
+
self.upload_file(tmpzip, upload_url_template, api_token, api_bearer)
|
111
114
|
end
|
112
115
|
else
|
113
|
-
self.upload_file(absolute_path, upload_url_template, api_token)
|
116
|
+
self.upload_file(absolute_path, upload_url_template, api_token, api_bearer)
|
114
117
|
end
|
115
118
|
end
|
116
119
|
|
117
|
-
def self.upload_file(file, url_template, api_token)
|
120
|
+
def self.upload_file(file, url_template, api_token, api_bearer)
|
118
121
|
require 'addressable/template'
|
119
122
|
file_name = File.basename(file)
|
120
123
|
expanded_url = Addressable::Template.new(url_template).expand(name: file_name).to_s
|
@@ -122,6 +125,7 @@ module Fastlane
|
|
122
125
|
UI.important("Uploading #{file_name}")
|
123
126
|
GithubApiAction.run(
|
124
127
|
api_token: api_token,
|
128
|
+
api_bearer: api_bearer,
|
125
129
|
http_method: 'POST',
|
126
130
|
headers: headers,
|
127
131
|
url: expanded_url,
|
@@ -173,12 +177,21 @@ module Fastlane
|
|
173
177
|
FastlaneCore::ConfigItem.new(key: :api_token,
|
174
178
|
env_name: "FL_GITHUB_RELEASE_API_TOKEN",
|
175
179
|
description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens",
|
180
|
+
conflicting_options: [:api_bearer],
|
176
181
|
sensitive: true,
|
177
182
|
code_gen_sensitive: true,
|
178
183
|
is_string: true,
|
179
184
|
default_value: ENV["GITHUB_API_TOKEN"],
|
180
185
|
default_value_dynamic: true,
|
181
|
-
optional:
|
186
|
+
optional: true),
|
187
|
+
FastlaneCore::ConfigItem.new(key: :api_bearer,
|
188
|
+
env_name: "FL_GITHUB_RELEASE_API_BEARER",
|
189
|
+
sensitive: true,
|
190
|
+
code_gen_sensitive: true,
|
191
|
+
description: "Use a Bearer authorization token. Usually generated by Github Apps, e.g. GitHub Actions GITHUB_TOKEN environment variable",
|
192
|
+
conflicting_options: [:api_token],
|
193
|
+
optional: true,
|
194
|
+
default_value: nil),
|
182
195
|
FastlaneCore::ConfigItem.new(key: :tag_name,
|
183
196
|
env_name: "FL_SET_GITHUB_RELEASE_TAG_NAME",
|
184
197
|
description: "Pass in the tag name",
|
@@ -115,8 +115,8 @@ module Fastlane
|
|
115
115
|
is_string: false),
|
116
116
|
FastlaneCore::ConfigItem.new(key: :default_payloads,
|
117
117
|
env_name: "FL_SLACK_DEFAULT_PAYLOADS",
|
118
|
-
description: "
|
119
|
-
|
118
|
+
description: "Specifies default payloads to include. Pass an empty array to suppress all the default payloads",
|
119
|
+
default_value: ['lane', 'test_result', 'git_branch', 'git_author', 'last_git_commit', 'last_git_commit_hash'],
|
120
120
|
type: Array),
|
121
121
|
FastlaneCore::ConfigItem.new(key: :attachment_properties,
|
122
122
|
env_name: "FL_SLACK_ATTACHMENT_PROPERTIES",
|
@@ -159,8 +159,7 @@ module Fastlane
|
|
159
159
|
"Build Date" => Time.new.to_s,
|
160
160
|
"Built by" => "Jenkins",
|
161
161
|
},
|
162
|
-
default_payloads: [:git_branch, :git_author], # Optional, lets you specify
|
163
|
-
# Don\'t add this key, or pass nil, if you want all the default payloads. The available default payloads are: `lane`, `test_result`, `git_branch`, `git_author`, `last_git_commit`, `last_git_commit_hash`.
|
162
|
+
default_payloads: [:git_branch, :git_author], # Optional, lets you specify default payloads to include. Pass an empty array to suppress all the default payloads.
|
164
163
|
attachment_properties: { # Optional, lets you specify any other properties available for attachments in the slack API (see https://api.slack.com/docs/attachments).
|
165
164
|
# This hash is deep merged with the existing properties set using the other properties above. This allows your own fields properties to be appended to the existing fields that were created using the `payload` property for instance.
|
166
165
|
thumb_url: "http://example.com/path/to/thumb.png",
|
@@ -188,7 +187,7 @@ module Fastlane
|
|
188
187
|
|
189
188
|
def self.generate_slack_attachments(options)
|
190
189
|
color = (options[:success] ? 'good' : 'danger')
|
191
|
-
should_add_payload = ->(payload_name) { options[:default_payloads].
|
190
|
+
should_add_payload = ->(payload_name) { options[:default_payloads].map(&:to_sym).include?(payload_name.to_sym) }
|
192
191
|
|
193
192
|
slack_attachment = {
|
194
193
|
fallback: options[:message],
|