fastlane-plugin-jira_issues_release_notes 0.3.0 → 1.0.1
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 +267 -31
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_comment_action.rb +200 -0
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/{branch_jira_issues_release_notes_action.rb → jira_feature_validation_action.rb} +31 -47
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_keys_from_commits_action.rb +134 -0
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_release_changelog_action.rb +182 -0
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_release_validation_action.rb +173 -0
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_versions_action.rb +162 -0
- data/lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb +212 -17
- data/lib/fastlane/plugin/jira_issues_release_notes/version.rb +1 -1
- metadata +11 -7
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_release_notes_action.rb +0 -284
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d58fcb315c41c443bd61dc831b112046a00b52d1764845d93b63e90d250b95
|
4
|
+
data.tar.gz: b1393d3199ea350948051b6a7892110530c9d531e731c89c1d703086795dc35c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b7e29fb5ab1726cb180b16e0827762d807b1a90d5ef018774f6bdb8f51d2db22d6d31bec9ed3f8cba4a90b075103dc924b2e06d69be7bb190c51f3006dcd0a1
|
7
|
+
data.tar.gz: f9074c126db13e8c75d901fce406b3c1bcedbd7c9f98c5ca37e8693747c24774d57c26943a3705bf6d30a124c6d7c35342bf78b11b9cc2fca864d86e34acc426
|
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Jira Issues Release Notes - Fastlane Plugin
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/fastlane-plugin-jira_issues_release_notes)
|
4
|
+
[](https://github.com/erick-martins/fastlane-plugin-jira_issues_release_notes/blob/master/LICENSE)
|
5
|
+
[](https://badge.fury.io/rb/fastlane-plugin-jira_issues_release_notes)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
It generates a release note based on the issues keys and descriptions found in the commits and branch name
|
4
10
|
|
5
11
|
|
6
12
|
|
@@ -14,15 +20,9 @@ fastlane add_plugin jira_issues_release_notes
|
|
14
20
|
|
15
21
|
|
16
22
|
|
17
|
-
## About jira_issues_release_notes
|
18
|
-
|
19
|
-
It generates a release note based on the issues keys and descriptions found in the commits.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
23
|
## Actions
|
24
24
|
|
25
|
-
All actions requires some
|
25
|
+
All actions requires some parameters to access Jira API.
|
26
26
|
**These are the arguments the all share:**
|
27
27
|
|
28
28
|
| Argument | Type | Description | Optional | Default | Env Name |
|
@@ -32,22 +32,55 @@ All actions requires some parameter to access Jira API.
|
|
32
32
|
| host | `String` | Jira location | | | `FL_JIRA_HOST` |
|
33
33
|
| context_path | `String` | Jira context path | ✓ | Empty | `FL_JIRA_CONTEXT_PATH` |
|
34
34
|
| disable_ssl_verification | `Boolean` | Jira SSL Verification mode | ✓ | `false` | `FL_JIRA_DISABLE_SSL_VERIFICATION` |
|
35
|
+
| api_version | `String` | Jira api version | ✓ | 2 | `FL_JIRA_API_VERSION` |
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
### jira_issues_keys_from_commits
|
40
|
+
|
41
|
+
This action returns the list of jira issue keys extracted from your commits since the latest published tag.
|
42
|
+
|
43
|
+
**Arguments:**
|
44
|
+
|
45
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
46
|
+
| ----------------- | ------------------- | ---------------------------------------------- | -------- | ----------------- | -------------------------- |
|
47
|
+
| tag_prefix | `Regex` | Match prefix to find latest tag. Example: `v*` | | | |
|
48
|
+
| ticket_prefix | `String` or `Regex` | The prefix for yours jira issues | ✓ | `[A_Z]+` | `FL_FIND_TICKETS_MATCHING` |
|
49
|
+
| tag_version_match | `String` | To parse version number from tag name | ✓ | `/\d+\.\d+\.\d+/` | |
|
50
|
+
|
51
|
+
**Usage example:**
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
platform :android do
|
55
|
+
lane :develop do
|
56
|
+
keys = jira_issues_keys_from_commits(
|
57
|
+
tag_prefix: 'v*',
|
58
|
+
ticket_prefix: 'ABC',
|
59
|
+
username: ENV["FL_JIRA_USERNAME"],
|
60
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
61
|
+
host: ENV["FL_JIRA_HOST"],
|
62
|
+
)
|
63
|
+
|
64
|
+
puts keys
|
65
|
+
end
|
66
|
+
end
|
67
|
+
```
|
35
68
|
|
36
69
|
|
37
70
|
|
38
|
-
###
|
71
|
+
### jira_feature_validation
|
39
72
|
|
40
|
-
This action creates a
|
73
|
+
This action creates a release note based on the issue key extracted from your branch name. For example a branch called `feature/ABC-1234-some-feature` will extract the `ABC-1234` issue key.
|
41
74
|
|
42
|
-
It should be used to generate version to validate you branch's feature before
|
75
|
+
It should be used to generate version to validate you branch's feature before you merge it.
|
43
76
|
|
44
77
|
**Arguments:**
|
45
78
|
|
46
|
-
| Argument | Type
|
47
|
-
| ------------- |
|
48
|
-
| ticket_prefix | `String` or `Regex`
|
49
|
-
| extra_fields | `Hash`
|
50
|
-
| format | `slack`, `markdown` or `plain` | Defines the result format | ✓ | `markdown` | |
|
79
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
80
|
+
| ------------- | --------------------------------------- | ------------------------------------------------------------ | -------- | -------------------- | -------------------------- |
|
81
|
+
| ticket_prefix | `String` or `Regex` | The prefix for yours jira issues | ✓ | `[A_Z]+` | `FL_FIND_TICKETS_MATCHING` |
|
82
|
+
| extra_fields | `Hash` | A hash of extra Jira fields to display.<br />It should be a hash with key as the label for the key and value as the symbol representing the jira's key:<br />Example: `{ "My Custom Field" => :customfield_1 }` | ✓ | Empty Hash<br />`{}` | |
|
83
|
+
| format | `slack`, `markdown` , `html` or `plain` | Defines the result format | ✓ | `markdown` | |
|
51
84
|
|
52
85
|
**Usage example:**
|
53
86
|
|
@@ -55,12 +88,12 @@ It should be used to generate version to validate you branch's feature before it
|
|
55
88
|
# Branch: feature/ABC-1234-some-feature
|
56
89
|
|
57
90
|
platform :android do
|
58
|
-
|
91
|
+
lane :develop do
|
59
92
|
# Build a apk for development environment
|
60
93
|
build_develop
|
61
94
|
link_to_download = upload_to_s3
|
62
95
|
|
63
|
-
release_notes =
|
96
|
+
release_notes = jira_feature_validation(
|
64
97
|
ticket_prefix: 'ABC',
|
65
98
|
username: ENV["FL_JIRA_USERNAME"],
|
66
99
|
password: ENV["FL_JIRA_PASSWORD"],
|
@@ -74,7 +107,7 @@ platform :android do
|
|
74
107
|
slack(
|
75
108
|
pretext: ":android: A new android build is available for feature validation\n#{release_notes}",
|
76
109
|
payload: {
|
77
|
-
"
|
110
|
+
"Download it here" => link_to_download
|
78
111
|
},
|
79
112
|
success: true
|
80
113
|
)
|
@@ -84,7 +117,7 @@ end
|
|
84
117
|
|
85
118
|
|
86
119
|
|
87
|
-
###
|
120
|
+
### jira_release_validation
|
88
121
|
|
89
122
|
This action creates a changelog based on the issue keys extracted from your commits since the latest published tag.
|
90
123
|
|
@@ -94,13 +127,13 @@ It should be used to generate version to validate in QA stage.
|
|
94
127
|
|
95
128
|
```ruby
|
96
129
|
platform :android do
|
97
|
-
|
130
|
+
lane :staging_validation do
|
98
131
|
# Build a apk for staging environment
|
99
132
|
build_staging
|
100
133
|
link_to_download = upload_to_s3
|
101
134
|
|
102
|
-
release_notes =
|
103
|
-
tag_prefix: '
|
135
|
+
release_notes = jira_release_validation(
|
136
|
+
tag_prefix: 'v*',
|
104
137
|
ticket_prefix: 'ABC',
|
105
138
|
username: ENV["FL_JIRA_USERNAME"],
|
106
139
|
password: ENV["FL_JIRA_PASSWORD"],
|
@@ -113,7 +146,7 @@ platform :android do
|
|
113
146
|
slack(
|
114
147
|
pretext: ":android: A new android build is available for QA\n#{release_notes}",
|
115
148
|
payload: {
|
116
|
-
"
|
149
|
+
"Download it here" => link_to_download
|
117
150
|
},
|
118
151
|
success: true
|
119
152
|
)
|
@@ -123,14 +156,217 @@ end
|
|
123
156
|
|
124
157
|
**Arguments:**
|
125
158
|
|
126
|
-
| Argument | Type
|
127
|
-
| ------------------ |
|
128
|
-
| tag_prefix | `Regex`
|
129
|
-
| ticket_prefix | `String` or `Regex`
|
130
|
-
| tag_version_match | `String`
|
131
|
-
| validated_status | `Array`
|
132
|
-
| to_validate_status | `Array`
|
133
|
-
| format | `slack`, `markdown` or `plain` | Defines the result format
|
159
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
160
|
+
| ------------------ | --------------------------------------- | ---------------------------------------------- | -------- | ----------------- | ---------------------------- |
|
161
|
+
| tag_prefix | `Regex` | Match prefix to find latest tag. Example: `v*` | | | |
|
162
|
+
| ticket_prefix | `String` or `Regex` | The prefix for yours jira issues | ✓ | `[A_Z]+` | `FL_FIND_TICKETS_MATCHING` |
|
163
|
+
| tag_version_match | `String` | To parse version number from tag name | ✓ | `/\d+\.\d+\.\d+/` | |
|
164
|
+
| validated_status | `Array` | List of jira issues status already validated | | | `FL_JIRA_VALIDATED_STATUS` |
|
165
|
+
| to_validate_status | `Array` | List of jira issues status to be validated | | | `FL_JIRA_TO_VALIDATE_STATUS` |
|
166
|
+
| format | `slack`, `markdown` , `html` or `plain` | Defines the result format | ✓ | `markdown` | |
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
### jira_release_changelog
|
171
|
+
|
172
|
+
This action creates a changelog based on the issue keys extracted from your commits since the latest published tag.
|
173
|
+
|
174
|
+
It should be used to generate from a release version.
|
175
|
+
|
176
|
+
**Usage example:**
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
platform :android do
|
180
|
+
lane :release do
|
181
|
+
# Build and release a new version
|
182
|
+
build_production
|
183
|
+
release_production
|
184
|
+
|
185
|
+
# Hash with grouped types with names by issue type. Use de key work "ANY_TYPE" as fallback.
|
186
|
+
# The ordenation will reflect to the final result.
|
187
|
+
grouped_by_types = {
|
188
|
+
"Added/Changed" => ["ANY_TYPE"],
|
189
|
+
"Fixed" => ["Bug"]
|
190
|
+
}
|
191
|
+
|
192
|
+
release_notes = jira_release_changelog(
|
193
|
+
tag_prefix: 'v*',
|
194
|
+
ticket_prefix: 'ABC',
|
195
|
+
username: ENV["FL_JIRA_USERNAME"],
|
196
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
197
|
+
host: ENV["FL_JIRA_HOST"],
|
198
|
+
grouped_by_types: grouped_by_types,
|
199
|
+
format: 'slack',
|
200
|
+
)
|
201
|
+
|
202
|
+
slack(
|
203
|
+
pretext: ":android: A new android version was released\n#{release_notes}",
|
204
|
+
success: true
|
205
|
+
)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
```
|
209
|
+
|
210
|
+
**Arguments:**
|
211
|
+
|
212
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
213
|
+
| ----------------- | --------------------------------------- | ------------------------------------------------------------ | -------- | ----------------- | ------------------------------ |
|
214
|
+
| tag_prefix | `Regex` | Match prefix to find latest tag. Example: `v*` | | | |
|
215
|
+
| ticket_prefix | `String` or `Regex` | The prefix for yours jira issues | ✓ | `[A_Z]+` | `FL_FIND_TICKETS_MATCHING` |
|
216
|
+
| tag_version_match | `String` | To parse version number from tag name | ✓ | `/\d+\.\d+\.\d+/` | |
|
217
|
+
| grouped_by_types | `Hash` | Hash with grouped types with names by issue type. Use de key work "ANY_TYPE" as fallback. | | | `FL_JIRA_RELESE_GROUPED_TYPES` |
|
218
|
+
| format | `slack`, `markdown` , `html` or `plain` | Defines the result format | ✓ | `markdown` | |
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
### jira_comment
|
223
|
+
|
224
|
+
This action adds comment to the issue keys extracted from your commits since the latest published tag or the issue extract from the name of the branch.
|
225
|
+
|
226
|
+
**Usage example:**
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
def generate_comment_block(version: url:)
|
230
|
+
{
|
231
|
+
"type" => "doc",
|
232
|
+
"version" => 1,
|
233
|
+
"content" => [
|
234
|
+
{
|
235
|
+
"type" => "paragraph",
|
236
|
+
"content" => [
|
237
|
+
{
|
238
|
+
"type" => "text",
|
239
|
+
"text" => "A new Android build is available. (#{version})\n",
|
240
|
+
"marks" => [
|
241
|
+
{
|
242
|
+
"type" => "strong"
|
243
|
+
}
|
244
|
+
]
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"type" => "text",
|
248
|
+
"text" => "Download it here",
|
249
|
+
"marks" => [
|
250
|
+
{
|
251
|
+
"type" => "link",
|
252
|
+
"attrs" => {
|
253
|
+
"href" => "#{url}",
|
254
|
+
"title" => "Download it here"
|
255
|
+
}
|
256
|
+
}
|
257
|
+
]
|
258
|
+
}
|
259
|
+
]
|
260
|
+
}
|
261
|
+
]
|
262
|
+
}
|
263
|
+
end
|
264
|
+
|
265
|
+
platform :android do
|
266
|
+
lane :develop do
|
267
|
+
# Build a apk for development environment
|
268
|
+
build_develop
|
269
|
+
link_to_download = upload_to_s3
|
270
|
+
|
271
|
+
# Comment on issues
|
272
|
+
comment_block = generate_comment_block(
|
273
|
+
version: "v2.5.0",
|
274
|
+
url: "https://some-link-to-download.com"
|
275
|
+
)
|
276
|
+
|
277
|
+
jira_comment(
|
278
|
+
username: ENV["FL_JIRA_USERNAME"],
|
279
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
280
|
+
host: ENV["FL_JIRA_HOST"],
|
281
|
+
ticket_prefix: 'ABC',
|
282
|
+
tag_prefix: "v*",
|
283
|
+
comment_block: comment_block
|
284
|
+
)
|
285
|
+
end
|
286
|
+
|
287
|
+
lane :staging_validation do
|
288
|
+
# Build a apk for staging environment
|
289
|
+
# Build a apk for staging environment
|
290
|
+
build_staging
|
291
|
+
link_to_download = upload_to_s3
|
292
|
+
|
293
|
+
# Comment on issues
|
294
|
+
comment_block = generate_comment_block(
|
295
|
+
version: "v2.5.0",
|
296
|
+
url: "https://some-link-to-download.com"
|
297
|
+
)
|
298
|
+
|
299
|
+
jira_comment(
|
300
|
+
username: ENV["FL_JIRA_USERNAME"],
|
301
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
302
|
+
host: ENV["FL_JIRA_HOST"],
|
303
|
+
ticket_prefix: 'ABC',
|
304
|
+
extract_from_branch: true,
|
305
|
+
comment_block: comment_block
|
306
|
+
)
|
307
|
+
end
|
308
|
+
|
309
|
+
lane :release do
|
310
|
+
# Build a apk for staging environment
|
311
|
+
build_production
|
312
|
+
release_production
|
313
|
+
|
314
|
+
jira_comment(
|
315
|
+
username: ENV["FL_JIRA_USERNAME"],
|
316
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
317
|
+
host: ENV["FL_JIRA_HOST"],
|
318
|
+
ticket_prefix: 'ABC',
|
319
|
+
extract_from_branch: true,
|
320
|
+
comment: "Resolved on version #{version} published #{now_date}"
|
321
|
+
)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
```
|
325
|
+
|
326
|
+
**Arguments:**
|
327
|
+
|
328
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
329
|
+
| ------------------- | ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ----------------- | -------------------------- |
|
330
|
+
| tag_prefix | `Regex` | Match prefix to find latest tag. Example: `v*` | ✓<br />Conflicts with `:extract_from_branch`<br /><br />If you set to extract keys from the branch, it should not be set | | |
|
331
|
+
| ticket_prefix | `String` or `Regex` | The prefix for yours jira issues | ✓ | `[A_Z]+` | `FL_FIND_TICKETS_MATCHING` |
|
332
|
+
| tag_version_match | `String` | To parse version number from tag name | ✓ | `/\d+\.\d+\.\d+/` | |
|
333
|
+
| extract_from_branch | `Boolean` | If true it will search for jira issue key in the current branch name. In this case do NOT set `:tag_prefix` | ✓<br />Conflicts with `:tag_prefix`<br /><br />If you set `:tag_prefix`, it should not be set or set to `false` | `false` | |
|
334
|
+
| comment | `String` | Comment to add to the ticket | ✓<br />Conflicts with `:comment_block`<br /><br />If you set `:comment_block`, it should not be set. | | |
|
335
|
+
| comment_block | `Hash` | Comment block to add to the ticket | ✓<br />Conflicts with `:comment`<br /><br />If you set `:comment`, it should not be set. | | |
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
### jira_versions
|
340
|
+
|
341
|
+
This action searches jira versions and returns the list
|
342
|
+
|
343
|
+
**Arguments:**
|
344
|
+
|
345
|
+
| Argument | Type | Description | Optional | Env Name |
|
346
|
+
| ---------- | -------- | ------------------------------------------------------------ | -------- | -------------------- |
|
347
|
+
| project_id | `String` | The project ID or project key | | `FL_JIRA_PROJECT_ID` |
|
348
|
+
| query | `String` | Filter the results using a literal string. Versions with matching `name` or `description` are returned (case insensitive). | ✓ | |
|
349
|
+
| order_by | `String` | Order the results by a field.<br />Valid values: `description`, `-description`, `+description`, `name`, `-name`, `+name`, `releaseDate`, `-releaseDate`, `+releaseDate`, `sequence`, `-sequence`, `+sequence`, `startDate`, `-startDate`, `+startDate` | ✓ | |
|
350
|
+
| status | `String` | A list of status values used to filter the results by version status. This parameter accepts a comma-separated list. The status values are `released`, `unreleased`, and `archived`. | ✓ | |
|
351
|
+
|
352
|
+
**Usage example:**
|
353
|
+
|
354
|
+
```ruby
|
355
|
+
platform :android do
|
356
|
+
lane :release do
|
357
|
+
versions = jira_versions(
|
358
|
+
project_id: 'ABC',
|
359
|
+
query: 'app_v2.5.0',
|
360
|
+
status: 'released,archived',
|
361
|
+
username: ENV["FL_JIRA_USERNAME"],
|
362
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
363
|
+
host: ENV["FL_JIRA_HOST"],
|
364
|
+
)
|
365
|
+
|
366
|
+
puts versions
|
367
|
+
end
|
368
|
+
end
|
369
|
+
```
|
134
370
|
|
135
371
|
|
136
372
|
|
@@ -0,0 +1,200 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/jira_issues_release_notes_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
FL_JIRA_LAST_TAG ||= :S3_APK_OUTPUT_PATH
|
8
|
+
FL_JIRA_LAST_TAG_HASH ||= :FL_JIRA_LAST_TAG_HASH
|
9
|
+
FL_JIRA_COMMITS_FROM_HASH ||= :FL_JIRA_COMMITS_FROM_HASH
|
10
|
+
FL_JIRA_LAST_KEYS_FROM_COMMITS ||= :FL_JIRA_LAST_KEYS_FROM_COMMITS
|
11
|
+
FL_JIRA_LAST_ISSUES_FROM_COMMITS ||= :FL_JIRA_LAST_ISSUES_FROM_COMMITS
|
12
|
+
end
|
13
|
+
|
14
|
+
class JiraCommentAction < Action
|
15
|
+
def self.run(params)
|
16
|
+
api_version = params[:api_version].to_i
|
17
|
+
|
18
|
+
UI.user_error! "Comments block are only available from api version 3 or earlier" if api_version < 3 and params[:comment_block]
|
19
|
+
|
20
|
+
@jira_helper = Helper::JiraIssuesReleaseNotesHelper.initialize_jira(
|
21
|
+
host: params[:host],
|
22
|
+
api_version: api_version,
|
23
|
+
username: params[:username],
|
24
|
+
password: params[:password],
|
25
|
+
context_path: params[:context_path],
|
26
|
+
disable_ssl_verification: params[:disable_ssl_verification]
|
27
|
+
)
|
28
|
+
|
29
|
+
issues = []
|
30
|
+
if params[:extract_from_branch] then
|
31
|
+
branch = other_action.git_branch
|
32
|
+
ticket_key = Helper::JiraIssuesReleaseNotesHelper.extract_key_from_branch(
|
33
|
+
branch: branch,
|
34
|
+
ticket_prefix: params[:ticket_prefix]
|
35
|
+
)
|
36
|
+
|
37
|
+
unless ticket_key
|
38
|
+
UI.error "Could not extract issue key from branch #{branch}"
|
39
|
+
false
|
40
|
+
end
|
41
|
+
|
42
|
+
issues = @jira_helper.get(keys: [ticket_key])
|
43
|
+
else
|
44
|
+
|
45
|
+
issue_key_regex = Regexp.new("(#{params[:ticket_prefix]}-\\d+)")
|
46
|
+
|
47
|
+
issues = Helper::JiraIssuesReleaseNotesHelper.get_issues_from_commit_after_latest_tag(
|
48
|
+
tag_regex: params[:tag_prefix],
|
49
|
+
tag_version_match: params[:tag_version_match],
|
50
|
+
issue_key_regex: issue_key_regex,
|
51
|
+
debug: params[:debug]
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
unless !issues.empty?
|
56
|
+
UI.error "No issue could be matched with (#{params[:ticket_prefix]}-\\d+)"
|
57
|
+
false
|
58
|
+
end
|
59
|
+
|
60
|
+
@jira_helper.add_comment(
|
61
|
+
comment: params[:comment_block] || params[:comment],
|
62
|
+
issues: issues
|
63
|
+
)
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.description
|
68
|
+
"It generates a release note based on the issues keys found in branch name and descriptions found in the commits"
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.authors
|
72
|
+
["Erick Martins"]
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.return_value
|
76
|
+
"boolean value"
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.details
|
80
|
+
# Optional:
|
81
|
+
"It generates a release note based on the issues keys found in branch name and descriptions found in the commits"
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.available_options
|
85
|
+
conflict_extraction_method = Proc.new do |other|
|
86
|
+
UI.user_error! "Unexpected conflict with option #{other}" unless [:extract_from_branch, :tag_prefix].include?(other)
|
87
|
+
end
|
88
|
+
|
89
|
+
conflict_comment = Proc.new do |other|
|
90
|
+
UI.user_error! "Unexpected conflict with option #{other}" unless [:comment_block, :comment].include?(other)
|
91
|
+
end
|
92
|
+
|
93
|
+
[
|
94
|
+
FastlaneCore::ConfigItem.new(
|
95
|
+
key: :tag_prefix,
|
96
|
+
description: "Match parameter of git describe. See man page of git describe for more info",
|
97
|
+
optional: true,
|
98
|
+
conflicting_options: [:extract_from_branch],
|
99
|
+
conflict_block: conflict_extraction_method
|
100
|
+
),
|
101
|
+
FastlaneCore::ConfigItem.new(
|
102
|
+
key: :ticket_prefix,
|
103
|
+
env_name: 'FL_FIND_TICKETS_MATCHING',
|
104
|
+
description: 'regex to extract ticket numbers',
|
105
|
+
default_value: '[A-Z]+',
|
106
|
+
optional: true
|
107
|
+
),
|
108
|
+
FastlaneCore::ConfigItem.new(
|
109
|
+
key: :tag_version_match,
|
110
|
+
description: "To parse version number from tag name",
|
111
|
+
default_value: '\d+\.\d+\.\d+',
|
112
|
+
optional: true
|
113
|
+
),
|
114
|
+
FastlaneCore::ConfigItem.new(
|
115
|
+
key: :extract_from_branch,
|
116
|
+
description: "If true it will search for jira issue key in the current branch name. In this case do NOT set :tag_prefix",
|
117
|
+
conflicting_options: [:tag_prefix],
|
118
|
+
conflict_block: conflict_extraction_method,
|
119
|
+
default_value: false,
|
120
|
+
optional: true,
|
121
|
+
type: Boolean
|
122
|
+
),
|
123
|
+
FastlaneCore::ConfigItem.new(
|
124
|
+
key: :comment,
|
125
|
+
description: 'Comment to add to the ticket',
|
126
|
+
conflicting_options: [:comment_block],
|
127
|
+
conflict_block: conflict_comment,
|
128
|
+
optional: true,
|
129
|
+
type: String,
|
130
|
+
),
|
131
|
+
FastlaneCore::ConfigItem.new(
|
132
|
+
key: :comment_block,
|
133
|
+
description: 'Comment block to add to the ticket',
|
134
|
+
conflicting_options: [:comment],
|
135
|
+
optional: true,
|
136
|
+
conflict_block: conflict_comment,
|
137
|
+
type: Hash,
|
138
|
+
),
|
139
|
+
|
140
|
+
# Jira Client options
|
141
|
+
FastlaneCore::ConfigItem.new(
|
142
|
+
key: :username,
|
143
|
+
env_name: 'FL_JIRA_USERNAME',
|
144
|
+
description: 'Jira user',
|
145
|
+
optional: false
|
146
|
+
),
|
147
|
+
FastlaneCore::ConfigItem.new(
|
148
|
+
key: :password,
|
149
|
+
env_name: 'FL_JIRA_PASSWORD',
|
150
|
+
description: 'Jira user',
|
151
|
+
optional: false
|
152
|
+
),
|
153
|
+
FastlaneCore::ConfigItem.new(
|
154
|
+
key: :host,
|
155
|
+
env_name: 'FL_JIRA_HOST',
|
156
|
+
description: 'Jira location',
|
157
|
+
optional: false
|
158
|
+
),
|
159
|
+
FastlaneCore::ConfigItem.new(
|
160
|
+
key: :api_version,
|
161
|
+
env_name: 'FL_JIRA_API_VERSION',
|
162
|
+
description: 'Jira api version',
|
163
|
+
default_value: '3',
|
164
|
+
optional: true,
|
165
|
+
),
|
166
|
+
FastlaneCore::ConfigItem.new(
|
167
|
+
key: :context_path,
|
168
|
+
env_name: 'FL_JIRA_CONTEXT_PATH',
|
169
|
+
description: 'Jira context path',
|
170
|
+
optional: true,
|
171
|
+
default_value: ''
|
172
|
+
),
|
173
|
+
FastlaneCore::ConfigItem.new(
|
174
|
+
key: :disable_ssl_verification,
|
175
|
+
env_name: 'FL_JIRA_DISABLE_SSL_VERIFICATION',
|
176
|
+
description: 'Jira SSL Verification mode',
|
177
|
+
optional: true,
|
178
|
+
default_value: false,
|
179
|
+
type: Boolean
|
180
|
+
),
|
181
|
+
FastlaneCore::ConfigItem.new(
|
182
|
+
key: :debug,
|
183
|
+
description: "True if you want to log out a debug info",
|
184
|
+
default_value: false,
|
185
|
+
type: Boolean,
|
186
|
+
optional: true
|
187
|
+
)
|
188
|
+
]
|
189
|
+
end
|
190
|
+
|
191
|
+
def self.is_supported?(platform)
|
192
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
193
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
194
|
+
#
|
195
|
+
# [:ios, :mac, :android].include?(platform)
|
196
|
+
true
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|