fastlane-plugin-bitrise_automation 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0241689ccd66d05a0836120f501ef00feffdfa51348545c49b66b32eaa01dd82'
4
- data.tar.gz: 8e60ba4980310e128b1d8f2027ba957a93edef5da559f3a50176d22e40a3256d
3
+ metadata.gz: b27fe1a3025eea6ee77d8505ff4183c43bb356cc71cd09c413c8849200a48971
4
+ data.tar.gz: 4b3c925f4355c3f90e8400db8c9b8060e6984a0f60b48d5f00628b149bbb7c26
5
5
  SHA512:
6
- metadata.gz: 6495f2a4420b45222c9c9d0a876fbb22895da86aa10c7d844f2067ebbd67be5f79c4a5001b800345e9955c9f6f6b97c01547c35013927a90c04e4526e08b4b46
7
- data.tar.gz: a38360cbfa1de1e1cd476fa4afd768456dd443571f02e00aaa3bf489e45dc2724a431a5991333e9647e71388d4dac02b97cc8ab59d6d842661eecbbb66629dbe
6
+ metadata.gz: d7f1fe9010ff5c93eb8f7bef088308516e3d9cfb935e02c6f90a6d6a09545f7f3b1e78bbd78a64b7e87388067486241ee9c7e68b1889027821e47aa398f15628
7
+ data.tar.gz: 22c993e63c366f99ebc0d1a8943a816d008faa2dfe6a6384d884b498e7c3e1a53d04cc3171b47741e2d3df15607d33bc5b7636f788a4185f329b1c4ecdfbc55e
data/README.md CHANGED
@@ -12,7 +12,7 @@ fastlane add_plugin bitrise_automation
12
12
 
13
13
  ## About bitrise_automation
14
14
 
15
- Interact with [Bitrise](https://bitrise.io/) projects from fastlane.
15
+ Interact with [Bitrise](https://bitrise.io/) projects from fastlane. This allows you to trigger a Bitrise workflow and its related information using the [Bitrise API](https://devcenter.bitrise.io/api/api-index/).
16
16
 
17
17
  This is useful if you want to interact with Bitrise from your terminal using Fastlane or if you are encapsulating Bitrise builds from another CI (such as Jenkins).
18
18
 
@@ -33,6 +33,66 @@ This plugin assumes you already have an app configured on Bitrise and uses a Per
33
33
  - The environments option to trigger the build is not implemented
34
34
  - Pagination on API responses is not implemented
35
35
 
36
+ ## Usage
37
+
38
+ It is recommended to set the `BITRISE_APP_SLUG` and `BITRISE_ACCESS_TOKEN` environment variables to avoid committing those values into your repository.
39
+
40
+ ### trigger_bitrise_workflow
41
+ Use this action to trigger a workflow on Bitrise and query its status.
42
+
43
+ | Key | Description | Environment variable | Default value |
44
+ | --- | --- | --- | --- |
45
+ | `app_slug` | The app slug of the project on Bitrise | BITRISE_APP_SLUG | |
46
+ | `access_token` | The [personal access token](https://devcenter.bitrise.io/api/authentication/) used to call Bitrise API | BITRISE_ACCESS_TOKEN | |
47
+ | `workflow` | The name of the workflow to trigger | BITRISE_WORKFLOW | |
48
+ | `commit_hash` | The hash of the commit that will be checked out | BITRISE_BUILD_COMMIT_HASH | |
49
+ | `build_message` | A custom message that will be used to identify the build | BITRISE_BUILD_MESSAGE | |
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
+
52
+ The returned value is a hash containing the information about the build.
53
+
54
+ | Hash key | Description |
55
+ | --- | --- |
56
+ | `status` | The status of the build |
57
+ | `build_slug` | The build slug that can be used to identify the build on other actions |
58
+ | `build_number` | The build number |
59
+ | `build_url` | The URL to the build page on Bitrise |
60
+
61
+ ### bitrise_build_status
62
+ Use this action to query the status of a build on Bitrise.
63
+
64
+ | Key | Description | Environment variable | Default value |
65
+ | --- | --- | --- | --- |
66
+ | `app_slug` | The app slug of the project on Bitrise | BITRISE_APP_SLUG | |
67
+ | `access_token` | The [personal access token](https://devcenter.bitrise.io/api/authentication/) used to call Bitrise API | BITRISE_ACCESS_TOKEN | |
68
+ | `build_slug` | The slug that identifies the build on Bitrise | BITRISE_BUILD_SLUG | |
69
+
70
+ The returned value is a hash containing the information about the build status.
71
+
72
+ | Hash key | Description |
73
+ | --- | --- |
74
+ | `status` | The status of the build: not finished (0), successful (1), failed (2), aborted with failure (3), aborted with success (4) |
75
+ | `status_text` | The status text |
76
+ | `is_on_hold` | Indicates whether the build has started yet (true: the build hasn't started) |
77
+
78
+ ### bitrise_build_artifacts
79
+ Use this action to retrieve information about the artifacts of a build or to automatically download them from Bitrise.
80
+
81
+ | Key | Description | Environment variable | Default value |
82
+ | --- | --- | --- | --- |
83
+ | `app_slug` | The app slug of the project on Bitrise | BITRISE_APP_SLUG | |
84
+ | `access_token` | The [personal access token](https://devcenter.bitrise.io/api/authentication/) used to call Bitrise API | BITRISE_ACCESS_TOKEN | |
85
+ | `build_slug` | The slug that identifies the build on Bitrise | BITRISE_BUILD_SLUG | |
86
+ | `download` | Whether to download or not the produced artifacts | BITRISE_ARTIFACTS_DOWNLOAD | |
87
+
88
+ 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
+ | Hash key | Description |
91
+ | --- | --- |
92
+ | `artifact_type` | The type of the artifact as detected by Bitrise |
93
+ | `file_size_bytes` | The size of the artifact in bytes |
94
+ | `slug` | The slug that identifies the artifact |
95
+ | `title` | The name of artifact |
36
96
 
37
97
  ## Example
38
98
 
@@ -29,9 +29,9 @@ module Fastlane
29
29
  title: artifact['title'])
30
30
  end
31
31
 
32
- if params[:download]
32
+ if params[:download] && !artifacts.empty?
33
33
  artifacts_dir = 'artifacts'
34
- UI.message("Download option is on. Will start download of #{artifacts.size} artifacts to #{artifacts_dir}.")
34
+ UI.message("Download option is on. Will start download of #{artifacts.size} artifacts to '#{artifacts_dir}'.")
35
35
  Dir.mkdir(artifacts_dir) unless Dir.exist?(artifacts_dir)
36
36
 
37
37
  artifacts.each do |artifact|
@@ -5,7 +5,10 @@ module Fastlane
5
5
  module Actions
6
6
  class BitriseBuildStatusAction < Action
7
7
  def self.run(params)
8
- get_status(params, params[:build_slug])
8
+ status = get_status(params, params[:build_slug])
9
+ FastlaneCore::PrintTable.print_values(config: status,
10
+ title: "Bitrise build '#{params[:build_slug]}' status")
11
+ status
9
12
  end
10
13
 
11
14
  def self.get_status(params, build_slug)
@@ -20,7 +20,7 @@ module Fastlane
20
20
 
21
21
  if response.code == "201"
22
22
  json_response = JSON.parse(response.body)
23
- UI.success("Build triggered successfully 🚀 URL: #{json_response['build_url']}")
23
+ UI.success("Build #{json_response['build_number']} triggered successfully on Bitrise 🚀 URL: #{json_response['build_url']}")
24
24
  FastlaneCore::PrintTable.print_values(config: json_response,
25
25
  title: "Bitrise API response")
26
26
  else
@@ -40,7 +40,7 @@ module Fastlane
40
40
  UI.success("Build has finished successfully on Bitrise!")
41
41
  build_infos["status"] = build_status["status_text"]
42
42
  elsif build_status["status"] == 2
43
- UI.build_failure!("Build has FAILED. Check Bitrise for details.")
43
+ UI.build_failure!("Build has FAILED on Bitrise. Check more details at #{build_infos["build_url"]}.")
44
44
  end
45
45
  end
46
46
 
@@ -91,12 +91,12 @@ module Fastlane
91
91
  type: String),
92
92
  FastlaneCore::ConfigItem.new(key: :workflow,
93
93
  env_name: "BITRISE_WORKFLOW",
94
- description: "The name of the workflow on Bitrise",
94
+ description: "The name of the workflow to trigger",
95
95
  optional: false,
96
96
  type: String),
97
97
  FastlaneCore::ConfigItem.new(key: :commit_hash,
98
98
  env_name: "BITRISE_BUILD_COMMIT_HASH",
99
- description: "The commit hash to be used on the build",
99
+ description: "The hash of the commit that will be checked out",
100
100
  optional: false,
101
101
  type: String),
102
102
  FastlaneCore::ConfigItem.new(key: :build_message,
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module BitriseAutomation
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-bitrise_automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Cecchi