fastlane-plugin-gitlab_release 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 04addcc3e215fcfe9f9568b812190a02646cdb08a0f9772681945a2ea9794cca
4
+ data.tar.gz: 97d3ab9bb0e4f95c5a3e1a1462cf6362ef988b9e8db42d118433c9b9edce5ad1
5
+ SHA512:
6
+ metadata.gz: 4010dcb73ad145d6d95cb3fbbc613870d3fe7190a35d696b767fca87a98b288e01969fcb856918214653d1da04bdb6b856d548fc9eeae841e9aacd343dde14a0
7
+ data.tar.gz: 362c2397ba9e5c22b55bdee42e0a93acfcaad527c270de9795df641507b5330fc95df82884b3f46e10ae50066b4621c62aa968fed68b70f0364e4cc56989d26f
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Andrea Del Fante <andreadelfante94@gmail.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.
@@ -0,0 +1,52 @@
1
+ # gitlab_release plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-gitlab_release)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-gitlab_release`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin gitlab_release
11
+ ```
12
+
13
+ ## About gitlab_release
14
+
15
+ Fastlane wrapper of gitlab-release-tools
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Example
20
+
21
+ 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
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using _fastlane_ Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About _fastlane_
51
+
52
+ _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,16 @@
1
+ require 'fastlane/plugin/gitlab_release/version'
2
+
3
+ module Fastlane
4
+ module GitlabRelease
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::GitlabRelease.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,129 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/gitlab_release_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class GitlabReleaseChangelogAction < Action
7
+ def self.run(params)
8
+ require 'gitlab/release/changelog/generator'
9
+
10
+ endpoint = params[:endpoint] || ENV["GITLAB_API_ENDPOINT"] || ENV["CI_API_V4_URL"]
11
+ private_token = params[:private_token] || ENV["GITLAB_API_PRIVATE_TOKEN"]
12
+ version_name = params[:version_name]
13
+ project_id = params[:project_id] || ENV["CI_PROJECT_ID"]
14
+ include_mrs = params[:include_mrs]
15
+ include_issues = params[:include_issues]
16
+ split_key = params[:split_key]
17
+ filtering_labels = params[:filtering_labels]
18
+ filtering_mrs_labels = params[:filtering_mrs_labels]
19
+ filtering_issues_labels = params[:filtering_issues_labels]
20
+
21
+ array_labels = filtering_labels.split(split_key) unless filtering_labels.empty?
22
+ array_mrs_labels = filtering_mrs_labels.split(split_key) unless filtering_mrs_labels.empty?
23
+ array_issues_labels = filtering_issues_labels.split(split_key) unless filtering_issues_labels.empty?
24
+
25
+ changelog_generator = Gitlab::Release::Changelog::Generator.new(endpoint, private_token)
26
+
27
+ UI.message("Creating changelog for version '#{version_name}'.")
28
+ changelog = changelog_generator.changelog(version_name,
29
+ project_id: project_id,
30
+ include_mrs: include_mrs,
31
+ include_issues: include_issues,
32
+ filtering_labels: array_labels,
33
+ filtering_mrs_labels: array_mrs_labels,
34
+ filtering_issues_labels: array_issues_labels)
35
+
36
+ UI.success("Generated changelog for #{version_name} successfully! :)")
37
+ changelog
38
+ end
39
+
40
+ def self.description
41
+ "Generate the changelog of a specific version"
42
+ end
43
+
44
+ def self.details
45
+ "This action generate the changelog from a specified version name."
46
+ end
47
+
48
+ def self.authors
49
+ ["Andrea Del Fante"]
50
+ end
51
+
52
+ def self.return_value
53
+ "Return a 'Entries' object containing changelogs"
54
+ end
55
+
56
+ def self.available_options
57
+ [
58
+ FastlaneCore::ConfigItem.new(key: :endpoint,
59
+ env_name: "GITLAB_API_ENDPOINT",
60
+ description: "API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] and falls back to ENV['CI_API_V4_URL']",
61
+ optional: true,
62
+ type: String),
63
+ FastlaneCore::ConfigItem.new(key: :private_token,
64
+ env_name: "GITLAB_API_PRIVATE_TOKEN",
65
+ description: "user's private token or OAuth2 access token",
66
+ optional: true,
67
+ type: String),
68
+ FastlaneCore::ConfigItem.new(key: :version_name,
69
+ description: "The version name to generate the changelog",
70
+ optional: false,
71
+ type: String),
72
+ FastlaneCore::ConfigItem.new(key: :project_id,
73
+ env_name: "CI_PROJECT_ID",
74
+ description: "The id of this project",
75
+ optional: true,
76
+ is_string: false,
77
+ verify_block: proc do |value|
78
+ case value
79
+ when String, Integer
80
+ @project_id = value
81
+ else
82
+ UI.user_error!("The project_id must be a String or Integer value.")
83
+ end
84
+ end),
85
+ FastlaneCore::ConfigItem.new(key: :include_mrs,
86
+ env_name: "GITLAB_RELEASE_INCLUDE_MRS",
87
+ description: "Should I include MRs in the changelog?",
88
+ optional: true,
89
+ type: Boolean,
90
+ default_value: true),
91
+ FastlaneCore::ConfigItem.new(key: :include_issues,
92
+ env_name: "GITLAB_RELEASE_INCLUDE_ISSUES",
93
+ description: "Should I include issues in the changelog?",
94
+ optional: true,
95
+ type: Boolean,
96
+ default_value: false),
97
+ FastlaneCore::ConfigItem.new(key: :split_key,
98
+ env_name: "GITLAB_RELEASE_SPLIT_FINTERING_KEY",
99
+ description: "A split key for separate filtering labels",
100
+ optional: true,
101
+ type: String,
102
+ default_value: ","),
103
+ FastlaneCore::ConfigItem.new(key: :filtering_labels,
104
+ env_name: "GITLAB_RELEASE_FILTERING_LABELS",
105
+ description: "A general list of labels to filter items. You must separate labels with split key (default: ,)",
106
+ optional: true,
107
+ type: String,
108
+ default_value: ""),
109
+ FastlaneCore::ConfigItem.new(key: :filtering_mrs_labels,
110
+ env_name: "GITLAB_RELEASE_FILTERING_MRS_LABELS",
111
+ description: "A specific list of labels to filter MRs. You must separate labels with split key (default: ,)",
112
+ optional: true,
113
+ type: String,
114
+ default_value: ""),
115
+ FastlaneCore::ConfigItem.new(key: :filtering_issues_labels,
116
+ env_name: "GITLAB_RELEASE_FILTERING_ISSUES_LABELS",
117
+ description: "A specific list of labels to filter issues. You must separate labels with split key (default: ,)",
118
+ optional: true,
119
+ type: String,
120
+ default_value: "")
121
+ ]
122
+ end
123
+
124
+ def self.is_supported?(platform)
125
+ true
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,97 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/gitlab_release_helper'
3
+
4
+ require 'gitlab/release/changelog/entries'
5
+
6
+ module Fastlane
7
+ module Actions
8
+ class GitlabReleaseCloseAction < Action
9
+ def self.run(params)
10
+ require 'gitlab/release/manager'
11
+
12
+ endpoint = params[:endpoint] || ENV["GITLAB_API_ENDPOINT"] || ENV["CI_API_V4_URL"]
13
+ private_token = params[:private_token] || ENV["GITLAB_API_PRIVATE_TOKEN"]
14
+ version_name = params[:version_name]
15
+ entries = params[:entries]
16
+ tag_name = params[:tag_name] || version_name
17
+ project_id = params[:project_id] || ENV["CI_PROJECT_ID"]
18
+ ref = params[:ref] || ENV["CI_COMMIT_SHA"]
19
+
20
+ manager = Gitlab::Release::Manager.new(endpoint, private_token)
21
+
22
+ UI.message("Closing all milestones related to version '#{version_name}'")
23
+ manager.close_milestones(version_name,
24
+ project_id: project_id)
25
+ UI.success("All milestones related to version '#{version_name}' are closed now!")
26
+
27
+ UI.message("Defining tag '#{tag_name}' in '#{ref}'")
28
+ manager.define_tag(tag_name,
29
+ entries.to_s_with_reference(true),
30
+ project_id: project_id,
31
+ ref: ref)
32
+ UI.success("Defined tag '#{tag_name}' with changelog successfully!")
33
+ end
34
+
35
+ def self.description
36
+ "Create a tag with release note and close milestones"
37
+ end
38
+
39
+ def self.details
40
+ "This action create a tag containing release note and close the associated milestones"
41
+ end
42
+
43
+ def self.authors
44
+ ["Andrea Del Fante"]
45
+ end
46
+
47
+ def self.available_options
48
+ [
49
+ FastlaneCore::ConfigItem.new(key: :endpoint,
50
+ env_name: "GITLAB_API_ENDPOINT",
51
+ description: "API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] and falls back to ENV['CI_API_V4_URL']",
52
+ optional: true,
53
+ type: String),
54
+ FastlaneCore::ConfigItem.new(key: :private_token,
55
+ env_name: "GITLAB_API_PRIVATE_TOKEN",
56
+ description: "user's private token or OAuth2 access token",
57
+ optional: true,
58
+ type: String),
59
+ FastlaneCore::ConfigItem.new(key: :version_name,
60
+ description: "The version name to generate the changelog",
61
+ optional: false,
62
+ type: String),
63
+ FastlaneCore::ConfigItem.new(key: :entries,
64
+ description: "The generated changelog to include",
65
+ optional: false,
66
+ type: Gitlab::Release::Changelog::Entries),
67
+ FastlaneCore::ConfigItem.new(key: :tag_name,
68
+ description: "The tag name to use in the creating tag. Default: version_name",
69
+ optional: true,
70
+ type: String),
71
+ FastlaneCore::ConfigItem.new(key: :project_id,
72
+ env_name: "CI_PROJECT_ID",
73
+ description: "The id of this project",
74
+ optional: true,
75
+ is_string: false,
76
+ verify_block: proc do |value|
77
+ case value
78
+ when String, Integer
79
+ @project_id = value
80
+ else
81
+ UI.user_error!("The project_id must be a String or Integer value.")
82
+ end
83
+ end),
84
+ FastlaneCore::ConfigItem.new(key: :ref,
85
+ env_name: "CI_COMMIT_SHA",
86
+ description: "The ref to tag with tag_name. default: ENV['CI_COMMIT_SHA']",
87
+ optional: true,
88
+ type: String)
89
+ ]
90
+ end
91
+
92
+ def self.is_supported?(platform)
93
+ true
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class GitlabReleaseHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::GitlabReleaseHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the gitlab_release plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module GitlabRelease
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-gitlab_release
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrea Del Fante
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gitlab-release-tools
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
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: rspec
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_junit_formatter
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: rake
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: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.49.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.49.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-require_tools
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: fastlane
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.136.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.136.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: dotenv
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description:
168
+ email: andreadelfante94@gmail.com
169
+ executables: []
170
+ extensions: []
171
+ extra_rdoc_files: []
172
+ files:
173
+ - LICENSE
174
+ - README.md
175
+ - lib/fastlane/plugin/gitlab_release.rb
176
+ - lib/fastlane/plugin/gitlab_release/actions/gitlab_release_changelog.rb
177
+ - lib/fastlane/plugin/gitlab_release/actions/gitlab_release_close.rb
178
+ - lib/fastlane/plugin/gitlab_release/helper/gitlab_release_helper.rb
179
+ - lib/fastlane/plugin/gitlab_release/version.rb
180
+ homepage: https://github.com/andreadelfante/fastlane-plugin-gitlab_release
181
+ licenses:
182
+ - MIT
183
+ metadata: {}
184
+ post_install_message:
185
+ rdoc_options: []
186
+ require_paths:
187
+ - lib
188
+ required_ruby_version: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ required_rubygems_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ requirements: []
199
+ rubygems_version: 3.0.6
200
+ signing_key:
201
+ specification_version: 4
202
+ summary: Fastlane wrapper of gitlab-release-tools
203
+ test_files: []