fastlane-plugin-bitrise_automation 0.2.1 → 0.3.0

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: 4d0d9adad859b0ea78e7de47ec6f893521a0a533bc5ea045cb9e5e52d77d79d0
4
- data.tar.gz: c5d20b80cd7cbe0d001cd75bda3b9f1f1b05bede24d307a4cb4fe66857026a07
3
+ metadata.gz: 9d3274b3ed05105c2dfe8956fea4c8d55fae8d1aed5ec7f9bae15ed076cf88a3
4
+ data.tar.gz: 4dc775d7576c6fecdaa85baee71c505238f7cdb5f2740b44670f9a3e8fe21d65
5
5
  SHA512:
6
- metadata.gz: 4630d2f61311d180f33b931b6eb5e6034b600ecdad92bb1e4d266abeaec775884d2f476b659f49488d121866dca198d01528cbb573c8ec5b892a76d0be5d8e92
7
- data.tar.gz: a9097cbd37cd73ff15590ac57964c658b5edfad237ca33dda9c4c8a9177fb7d55a3ee5aaffce6ee9d1f0f08007832119960229b96dca81cd0e8d443314460f02
6
+ metadata.gz: 7d356dbe591e4a55d144e105c5d52a982f32dd93fa7cb05f703d5bdcac9b58d20b3dbc5f791301c6bf066bd040834cb159b18ecd5a746461c0a11b24d22774f5
7
+ data.tar.gz: 4748f02214eac06df6a3630c42196d15205d980733d65743ba36dbe1cb39aac7790795634eec7544687b4bee2c9fc83ad93537508046dcd1dc1aa52a707aef5e
data/README.md CHANGED
@@ -28,7 +28,7 @@ This plugin assumes you already have an app configured on Bitrise and uses a Per
28
28
 
29
29
  ### Known issues
30
30
 
31
- - For now the only option is to trigger a build via a commit hash. It should be more flexible as Bitrise allows triggering by branch, tag, commit or default strategy.
31
+ - Triggering a build with a tag is not yet implemented
32
32
  - The author option to trigger the build is not implemented
33
33
  - The environments option to trigger the build is not implemented
34
34
  - Pagination on API responses is not implemented
@@ -45,8 +45,10 @@ Use this action to trigger a workflow on Bitrise and query its status.
45
45
  | `app_slug` | The app slug of the project on Bitrise | BITRISE_APP_SLUG | |
46
46
  | `access_token` | The [personal access token](https://devcenter.bitrise.io/api/authentication/) used to call Bitrise API | BITRISE_ACCESS_TOKEN | |
47
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 | |
48
+ | `branch` | The name of branch that will be checked out | BITRISE_BUILD_BRANCH | |
49
+ | `commit_hash` | The hash of the commit that will be checked out (overrides branch parameter) | BITRISE_BUILD_COMMIT_HASH | |
49
50
  | `build_message` | A custom message that will be used to identify the build | BITRISE_BUILD_MESSAGE | |
51
+ | `triggered_by` | A custom message that will be used to identify where the build was triggered from (optional) | BITRISE_BUILD_TRIGGERED_BY | |
50
52
  | `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
53
  | `download_artifacts` | Whether to download or not the produced artifacts | BITRISE_DOWNLOAD_ARTIFACTS | false |
52
54
 
@@ -7,16 +7,20 @@ module Fastlane
7
7
  def self.run(params)
8
8
  UI.message("Requesting new Bitrise.io build for workflow '#{params[:workflow]}'...")
9
9
 
10
- response = Helper::BitriseRequestHelper.post(params, 'builds', {
10
+ trigger_payload = {
11
11
  hook_info: {
12
12
  type: "bitrise"
13
13
  },
14
14
  build_params: {
15
- workflow_id: params[:workflow],
16
- commit_hash: params[:commit_hash],
17
- commit_message: params[:build_message]
15
+ workflow_id: params[:workflow]
18
16
  }
19
- }.to_json)
17
+ }
18
+ trigger_payload[:build_params][:branch] = params[:branch] unless params[:branch].nil? || params[:branch].empty?
19
+ trigger_payload[:build_params][:commit_hash] = params[:commit_hash] unless params[:commit_hash].nil? || params[:commit_hash].empty?
20
+ trigger_payload[:build_params][:commit_message] = params[:build_message] unless params[:build_message].nil? || params[:build_message].empty?
21
+ trigger_payload[:triggered_by] = params[:triggered_by] unless params[:triggered_by].nil? || params[:triggered_by].empty?
22
+
23
+ response = Helper::BitriseRequestHelper.post(params, 'builds', trigger_payload.to_json)
20
24
 
21
25
  if response.code == "201"
22
26
  json_response = JSON.parse(response.body)
@@ -102,15 +106,25 @@ module Fastlane
102
106
  description: "The name of the workflow to trigger",
103
107
  optional: false,
104
108
  type: String),
109
+ FastlaneCore::ConfigItem.new(key: :branch,
110
+ env_name: "BITRISE_BUILD_BRANCH",
111
+ description: "The name of branch that will be checked out",
112
+ optional: true,
113
+ type: String),
105
114
  FastlaneCore::ConfigItem.new(key: :commit_hash,
106
115
  env_name: "BITRISE_BUILD_COMMIT_HASH",
107
116
  description: "The hash of the commit that will be checked out",
108
- optional: false,
117
+ optional: true,
109
118
  type: String),
110
119
  FastlaneCore::ConfigItem.new(key: :build_message,
111
120
  env_name: "BITRISE_BUILD_MESSAGE",
112
121
  description: "A custom message that will be used to identify the build",
113
- optional: false,
122
+ optional: true,
123
+ type: String),
124
+ FastlaneCore::ConfigItem.new(key: :triggered_by,
125
+ env_name: "BITRISE_BUILD_TRIGGERED_BY",
126
+ description: "A custom message that will be used to identify where the build was triggered from",
127
+ optional: true,
114
128
  type: String),
115
129
  FastlaneCore::ConfigItem.new(key: :wait_for_build,
116
130
  env_name: "BITRISE_WAIT_FOR_BUILD",
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module BitriseAutomation
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
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.2.1
4
+ version: 0.3.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-31 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry