fastlane-plugin-bitrise_automation 0.1.1 → 0.2.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 +4 -4
- data/README.md +2 -1
- data/lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_artifacts_action.rb +12 -8
- data/lib/fastlane/plugin/bitrise_automation/actions/trigger_bitrise_workflow_action.rb +10 -2
- data/lib/fastlane/plugin/bitrise_automation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45bdd3a1b6931f1d714dd90b9f5b141e0a3e716b782bea685ada224ecefcf7c5
|
4
|
+
data.tar.gz: afb31287838a6eb998ff322a955536d91d6f086af4c58add8a421009fe6d98ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5548f5e317336d05d57be210e1dcc5ce763258a79117d4b45b099a55711b8500583a1910dcb1fce68558e317d9e2df9db4c847314932585cd26f34de711c09a8
|
7
|
+
data.tar.gz: b0dedb02ba555e46b6ba8a5418584a90ba7b30043e470e4f25fe78a3108cca3e6ec3110bc4d6b7b7e96ff5f8525a4b16b3a6508ced1e8103f3ad894db2c7d5dd
|
data/README.md
CHANGED
@@ -48,6 +48,7 @@ Use this action to trigger a workflow on Bitrise and query its status.
|
|
48
48
|
| `commit_hash` | The hash of the commit that will be checked out | BITRISE_BUILD_COMMIT_HASH | |
|
49
49
|
| `build_message` | A custom message that will be used to identify the build | BITRISE_BUILD_MESSAGE | |
|
50
50
|
| `wait_for_build` | Whether the action should wait until the build finishes or return immediately after requesting the build | BITRISE_WAIT_FOR_BUILD | false |
|
51
|
+
| `download_artifacts` | Whether to download or not the produced artifacts | BITRISE_DOWNLOAD_ARTIFACTS | false |
|
51
52
|
|
52
53
|
The returned value is a hash containing the information about the build.
|
53
54
|
|
@@ -83,7 +84,7 @@ Use this action to retrieve information about the artifacts of a build or to aut
|
|
83
84
|
| `app_slug` | The app slug of the project on Bitrise | BITRISE_APP_SLUG | |
|
84
85
|
| `access_token` | The [personal access token](https://devcenter.bitrise.io/api/authentication/) used to call Bitrise API | BITRISE_ACCESS_TOKEN | |
|
85
86
|
| `build_slug` | The slug that identifies the build on Bitrise | BITRISE_BUILD_SLUG | |
|
86
|
-
| `
|
87
|
+
| `download_artifacts` | Whether to download or not the produced artifacts | BITRISE_DOWNLOAD_ARTIFACTS | false |
|
87
88
|
|
88
89
|
The returned value is an list of hashes containing the information about the artifacts. If there are no artifacts, it returns an empty list.
|
89
90
|
|
@@ -5,7 +5,11 @@ module Fastlane
|
|
5
5
|
module Actions
|
6
6
|
class BitriseBuildArtifactsAction < Action
|
7
7
|
def self.run(params)
|
8
|
-
|
8
|
+
get_artifacts(params, params[:build_slug])
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.get_artifacts(params, build_slug)
|
12
|
+
response = Helper::BitriseRequestHelper.get(params, "builds/#{build_slug}/artifacts")
|
9
13
|
|
10
14
|
if response.code == "200"
|
11
15
|
json_response = JSON.parse(response.body)['data']
|
@@ -13,7 +17,7 @@ module Fastlane
|
|
13
17
|
UI.crash!("Error fetching build artifacts list on Bitrise.io. Status code: #{response.code}. #{response}")
|
14
18
|
end
|
15
19
|
|
16
|
-
UI.message("Found #{json_response.size} artifacts on Bitrise for build #{
|
20
|
+
UI.message("Found #{json_response.size} artifacts on Bitrise for build #{build_slug}.")
|
17
21
|
|
18
22
|
artifacts = json_response.map do |artifact|
|
19
23
|
{
|
@@ -29,14 +33,14 @@ module Fastlane
|
|
29
33
|
title: artifact['title'])
|
30
34
|
end
|
31
35
|
|
32
|
-
if params[:
|
36
|
+
if params[:download_artifacts] && !artifacts.empty?
|
33
37
|
artifacts_dir = 'artifacts'
|
34
38
|
UI.message("Download option is on. Will start download of #{artifacts.size} artifacts to '#{artifacts_dir}'.")
|
35
39
|
Dir.mkdir(artifacts_dir) unless Dir.exist?(artifacts_dir)
|
36
40
|
|
37
41
|
artifacts.each do |artifact|
|
38
42
|
UI.message("Fetching artifact '#{artifact['title']}' of type '#{artifact['artifact_type']}' (#{artifact['file_size_bytes']} bytes)...")
|
39
|
-
artifact_details = get_artifact_details(params, artifact['slug'])
|
43
|
+
artifact_details = get_artifact_details(params, build_slug, artifact['slug'])
|
40
44
|
|
41
45
|
download_artifact(artifact_details, artifacts_dir)
|
42
46
|
UI.message("Finished downloading artifact '#{artifact['title']}'.")
|
@@ -46,8 +50,8 @@ module Fastlane
|
|
46
50
|
artifacts
|
47
51
|
end
|
48
52
|
|
49
|
-
def self.get_artifact_details(params, artifact_slug)
|
50
|
-
response = Helper::BitriseRequestHelper.get(params, "builds/#{
|
53
|
+
def self.get_artifact_details(params, build_slug, artifact_slug)
|
54
|
+
response = Helper::BitriseRequestHelper.get(params, "builds/#{build_slug}/artifacts/#{artifact_slug}")
|
51
55
|
|
52
56
|
if response.code == "200"
|
53
57
|
json_response = JSON.parse(response.body)['data']
|
@@ -94,8 +98,8 @@ module Fastlane
|
|
94
98
|
description: "The slug that identifies the build on Bitrise",
|
95
99
|
optional: false,
|
96
100
|
type: String),
|
97
|
-
FastlaneCore::ConfigItem.new(key: :
|
98
|
-
env_name: "
|
101
|
+
FastlaneCore::ConfigItem.new(key: :download_artifacts,
|
102
|
+
env_name: "BITRISE_DOWNLOAD_ARTIFACTS",
|
99
103
|
description: "Whether to download or not the produced artifacts",
|
100
104
|
optional: true,
|
101
105
|
default_value: false,
|
@@ -35,12 +35,14 @@ module Fastlane
|
|
35
35
|
|
36
36
|
if params[:wait_for_build]
|
37
37
|
build_status = wait_until_build_completion(params, build_infos["build_slug"])
|
38
|
-
|
38
|
+
if params[:download_artifacts]
|
39
|
+
BitriseBuildArtifactsAction.get_artifacts(params, build_infos["build_slug"])
|
40
|
+
end
|
39
41
|
if build_status["status"] == 1
|
40
42
|
UI.success("Build has finished successfully on Bitrise!")
|
41
43
|
build_infos["status"] = build_status["status_text"]
|
42
44
|
elsif build_status["status"] == 2
|
43
|
-
UI.build_failure!("Build has FAILED on Bitrise. Check more details at #{build_infos[
|
45
|
+
UI.build_failure!("Build has FAILED on Bitrise. Check more details at #{build_infos['build_url']}.")
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -108,6 +110,12 @@ module Fastlane
|
|
108
110
|
env_name: "BITRISE_WAIT_FOR_BUILD",
|
109
111
|
description: "Whether the action should wait until the build finishes or return immediately after requesting the build",
|
110
112
|
optional: true,
|
113
|
+
default_value: false,
|
114
|
+
is_string: false),
|
115
|
+
FastlaneCore::ConfigItem.new(key: :download_artifacts,
|
116
|
+
env_name: "BITRISE_DOWNLOAD_ARTIFACTS",
|
117
|
+
description: "Whether to download or not the produced artifacts",
|
118
|
+
optional: true,
|
111
119
|
default_value: false,
|
112
120
|
is_string: false)
|
113
121
|
]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-bitrise_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Cecchi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|