fastlane-plugin-trigger_bitrise_build 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +51 -0
- data/lib/fastlane/plugin/trigger_bitrise_build/actions/trigger_bitrise_build_action.rb +132 -0
- data/lib/fastlane/plugin/trigger_bitrise_build/helper/trigger_bitrise_build_helper.rb +12 -0
- data/lib/fastlane/plugin/trigger_bitrise_build/version.rb +5 -0
- data/lib/fastlane/plugin/trigger_bitrise_build.rb +16 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e50628f15673a5829826c194d69c7221018bade7
|
4
|
+
data.tar.gz: 8137626b18e62e93ceb47f22201b44c884423b59
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 43ead407ffc1c6e69ba316ad250dbdfe2b27cf1b9a6f2506926e8c1f30fdfbc872a37e4fa58e0a549241beef3e021eff1e36a96d54a2964bdb3487f412d3389f
|
7
|
+
data.tar.gz: 64a383cbd52a0ded1f3871027322408863c9a5fc30c56718fa998f22315f5c80749cf227af16f88914c7f3eb77a74a904ac2907add6281e24ce747cea346a5c4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Nick Hammond <n.hammond@waracle.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# trigger_bitrise_build plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-trigger_bitrise_build)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-trigger_bitrise_build`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin trigger_bitrise_build
|
11
|
+
```
|
12
|
+
|
13
|
+
## About trigger_bitrise_build
|
14
|
+
|
15
|
+
Trigger a [Bitrise](https://bitrise.io) build from Fastlane
|
16
|
+
|
17
|
+
Bitrise is a Continuous Integration and Delivery (CI/CD) Platform as a Service (PaaS) with a main focus on mobile app development (iOS, Android, Xamarin, ...). It has the ability to programmatically trigger new builds using the [build trigger API](http://devcenter.bitrise.io/api/build-trigger/). This fastlane plugin is simply a wrapper for the trigger API.
|
18
|
+
|
19
|
+
## Example
|
20
|
+
|
21
|
+
A [bitrise](https://www.bitrise.io/users/sign_up) account is *required*. Once you have created an account and added an application, check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
22
|
+
|
23
|
+
|
24
|
+
## Run tests for this plugin
|
25
|
+
|
26
|
+
To run both the tests, and code style validation, run
|
27
|
+
|
28
|
+
```
|
29
|
+
rake
|
30
|
+
```
|
31
|
+
|
32
|
+
To automatically fix many of the styling issues, use
|
33
|
+
```
|
34
|
+
rubocop -a
|
35
|
+
```
|
36
|
+
|
37
|
+
## Issues and Feedback
|
38
|
+
|
39
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
40
|
+
|
41
|
+
## Troubleshooting
|
42
|
+
|
43
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
44
|
+
|
45
|
+
## Using _fastlane_ Plugins
|
46
|
+
|
47
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
48
|
+
|
49
|
+
## About _fastlane_
|
50
|
+
|
51
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,132 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class TriggerBitriseBuildAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.message("The trigger_bitrise_build plugin is working!")
|
6
|
+
|
7
|
+
app_slug = params[:app_slug] ||= ENV['BITRISE_APP_SLUG']
|
8
|
+
api_token = params[:api_token] ||= ENV['BITRISE_API_TOKEN']
|
9
|
+
app_title = params[:app_title] ||= ENV['BITRISE_APP_TITLE']
|
10
|
+
git_branch = params[:git_branch] ||= ENV['BITRISE_GIT_BRANCH']
|
11
|
+
git_tag = params[:git_tag] ||= ENV['BITRISE_GIT_TAG']
|
12
|
+
workflow_id = params[:workflow_id] ||= ENV['BITRISE_TRIGGERED_WORKFLOW_ID']
|
13
|
+
commit_message = params[:commit_message] ||= ENV['BITRISE_GIT_MESSAGE']
|
14
|
+
parameters = []
|
15
|
+
params[:parameters].each do |key, value|
|
16
|
+
parameters << {
|
17
|
+
mapped_to: key,
|
18
|
+
value: value,
|
19
|
+
is_expand: false
|
20
|
+
}
|
21
|
+
end
|
22
|
+
triggered_by = params[:triggered_by] ||= 'Fastlane Auto Triggerer'
|
23
|
+
|
24
|
+
bitrise_data = {
|
25
|
+
hook_info: {
|
26
|
+
type: "bitrise",
|
27
|
+
api_token: api_token
|
28
|
+
},
|
29
|
+
build_params: {
|
30
|
+
branch: git_branch,
|
31
|
+
workflow_id: workflow_id,
|
32
|
+
tag: git_tag,
|
33
|
+
commit_message: commit_message,
|
34
|
+
environments: parameters
|
35
|
+
},
|
36
|
+
triggered_by: triggered_by
|
37
|
+
}
|
38
|
+
|
39
|
+
bitrise_result = JSON.parse(sh("curl 'https://www.bitrise.io/app/#{app_slug}/build/start.json' --silent --data '#{bitrise_data.to_json}'"))
|
40
|
+
|
41
|
+
if (bitrise_result['status']).to_s != 'ok'
|
42
|
+
UI.build_failure!("Failed to trigger auto retrying of #{app_title} 😞")
|
43
|
+
abort("Failed to trigger auto rebuild")
|
44
|
+
end
|
45
|
+
|
46
|
+
UI.success("New build (#{bitrise_result['build_number']}) started at: #{bitrise_result['build_url']}")
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.description
|
50
|
+
"Trigger a Bitrise build from Fastlane"
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.authors
|
54
|
+
["Nick Hammond"]
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.return_value
|
58
|
+
# If your method provides a return value, you can describe here what it does
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.details
|
62
|
+
# Optional:
|
63
|
+
""
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.available_options
|
67
|
+
[
|
68
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
69
|
+
env_name: "BITRISE_API_TOKEN",
|
70
|
+
description: "The Build Trigger API token. Navigate to the app's code page to find it",
|
71
|
+
optional: false,
|
72
|
+
type: String),
|
73
|
+
|
74
|
+
FastlaneCore::ConfigItem.new(key: :app_slug,
|
75
|
+
env_name: "BITRISE_APP_SLUG",
|
76
|
+
description: "The app unique identifier. Navigate to the app's code page to find it",
|
77
|
+
optional: false,
|
78
|
+
type: String),
|
79
|
+
|
80
|
+
FastlaneCore::ConfigItem.new(key: :app_title,
|
81
|
+
env_name: "BITRISE_APP_TITLE",
|
82
|
+
description: "The app name. Navigate to the app's settings page to find it",
|
83
|
+
optional: true,
|
84
|
+
type: String),
|
85
|
+
|
86
|
+
FastlaneCore::ConfigItem.new(key: :git_branch,
|
87
|
+
env_name: "BITRISE_GIT_BRANCH",
|
88
|
+
description: "The branch of the repo to build",
|
89
|
+
optional: false,
|
90
|
+
type: String),
|
91
|
+
|
92
|
+
FastlaneCore::ConfigItem.new(key: :git_tag,
|
93
|
+
env_name: "BITRISE_GIT_TAG",
|
94
|
+
description: "The tag of the repo to build",
|
95
|
+
optional: true,
|
96
|
+
type: String),
|
97
|
+
|
98
|
+
FastlaneCore::ConfigItem.new(key: :workflow_id,
|
99
|
+
env_name: "BITRISE_TRIGGERED_WORKFLOW_ID",
|
100
|
+
description: "The Bitrise workflow to use",
|
101
|
+
optional: true,
|
102
|
+
type: String),
|
103
|
+
|
104
|
+
FastlaneCore::ConfigItem.new(key: :commit_message,
|
105
|
+
env_name: "BITRISE_GIT_MESSAGE",
|
106
|
+
description: "The message to pass to the build",
|
107
|
+
optional: true,
|
108
|
+
type: String),
|
109
|
+
|
110
|
+
FastlaneCore::ConfigItem.new(key: :parameters,
|
111
|
+
description: "Additional parameters to pass to the build",
|
112
|
+
optional: true,
|
113
|
+
type: Hash),
|
114
|
+
|
115
|
+
FastlaneCore::ConfigItem.new(key: :triggered_by,
|
116
|
+
description: "Name that should appear of who triggered the build",
|
117
|
+
optional: true,
|
118
|
+
type: String,
|
119
|
+
default_value: "Fastlane Auto Triggerer")
|
120
|
+
]
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.is_supported?(platform)
|
124
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
125
|
+
# See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
|
126
|
+
#
|
127
|
+
# [:ios, :mac, :android].include?(platform)
|
128
|
+
true
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
class TriggerBitriseBuildHelper
|
4
|
+
# class methods that you define here become available in your action
|
5
|
+
# as `Helper::TriggerBitriseBuildHelper.your_method`
|
6
|
+
#
|
7
|
+
def self.show_message
|
8
|
+
UI.message("Hello from the trigger_bitrise_build plugin helper!")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/trigger_bitrise_build/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module TriggerBitriseBuild
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::TriggerBitriseBuild.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-trigger_bitrise_build
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Hammond
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fastlane
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.62.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.62.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email: n.hammond@waracle.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- LICENSE
|
118
|
+
- README.md
|
119
|
+
- lib/fastlane/plugin/trigger_bitrise_build.rb
|
120
|
+
- lib/fastlane/plugin/trigger_bitrise_build/actions/trigger_bitrise_build_action.rb
|
121
|
+
- lib/fastlane/plugin/trigger_bitrise_build/helper/trigger_bitrise_build_helper.rb
|
122
|
+
- lib/fastlane/plugin/trigger_bitrise_build/version.rb
|
123
|
+
homepage: https://github.com/waracle/fastlane-plugin-trigger_bitrise_build
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.6.11
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: Trigger a Bitrise build from Fastlane
|
147
|
+
test_files: []
|