fastlane-plugin-semantic_release 1.19.4 → 1.22.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01b27d55095447fde70e3e0d4c0ca215b7473cb123723e01e6022d5a55e065a0
4
- data.tar.gz: 6d7b82296bad8e5d3655f8d428df731f3aaae1aa89ba12bd3e23b2183cafbeaa
3
+ metadata.gz: 2ca1b0eb20fc15eda85dd48a0e4b6f5aadf4a8ed70fea7e0747d9b7f6eaf305b
4
+ data.tar.gz: b768e8adae79e696ae6d5ebde4d32e946807f15047d71fba93acc83043e051b2
5
5
  SHA512:
6
- metadata.gz: c031c797fd3b19df15f029dd09e17913b2d001b10ef1cd1ac89ccc12ac3b624d43139d3dba7a9a0cea8e35e3d883086c20332d78b8a255109ac1d90e2d1a3fe7
7
- data.tar.gz: 33ceab41c2c7a0a192402c0dcd019fcf25346d3b65c3bf30f4f1f0cb5269da889c5be4a28b137cb5e646d60420890713dc4a258286d5e466f1d3797fdef3aa71
6
+ metadata.gz: 7db91c64c0ca78c7981202f543e898ef035931e3756791b7a60ccb15b451065411e94d32f8c044c18b5fa1f522ef18a3773e189097776238df5314e105c13524
7
+ data.tar.gz: f3bfa66b06e45476815cbdd39b487ee5ea2418c20795b6fca8f68e12e0d3290802f3a8f8297cd196b37bce1548c0b3e5d1f94eb644597d7016927db45f81d3a4
data/README.md CHANGED
@@ -139,6 +139,7 @@ is_releasable = analyze_commits(match: 'ios/beta*')
139
139
  | `tag_version_match` | Regex to extract the version number from a tag name | `'\d+\.\d+\.\d+'` |
140
140
  | `prevent_tag_fallback` | When `true`, don't fall back to `vX.Y.Z` tags if no match is found | `false` |
141
141
  | `codepush_friendly` | Commit types considered CodePush-compatible | `['chore', 'test', 'docs']` |
142
+ | `ignore_breaking_changes` | When `true`, breaking changes will not trigger a major version bump | `false` |
142
143
  | `show_version_path` | Print the calculated version for each commit | `true` |
143
144
  | `debug` | Enable verbose debug logging | `false` |
144
145
 
@@ -195,6 +196,7 @@ notes = conventional_changelog(format: 'slack', title: 'Android Alpha')
195
196
  | `display_author` | Show the author name for each commit | `false` |
196
197
  | `ignore_scopes` | Array of scopes to exclude | `[]` |
197
198
  | `include_scopes` | Array of scopes to exclusively include | `[]` |
199
+ | `ignore_breaking_changes` | When `true`, the breaking changes section will not appear in the changelog. Also reads from `lane_context` if set by `analyze_commits` | `false` |
198
200
  | `debug` | Enable verbose debug logging | `false` |
199
201
 
200
202
  ## Examples
@@ -222,6 +224,15 @@ analyze_commits(
222
224
  )
223
225
  ```
224
226
 
227
+ ### Ignoring breaking changes
228
+
229
+ Prevent breaking change markers from triggering major version bumps. The `!` suffix and `BREAKING CHANGE:` in the commit body will be ignored for both version bumping and changelog output:
230
+
231
+ ```ruby
232
+ analyze_commits(match: 'v*', ignore_breaking_changes: true)
233
+ notes = conventional_changelog(format: 'markdown')
234
+ ```
235
+
225
236
  ### Plain text changelog for TestFlight
226
237
 
227
238
  ```ruby
@@ -15,6 +15,7 @@ module Fastlane
15
15
  RELEASE_NEXT_VERSION = :RELEASE_NEXT_VERSION
16
16
  RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION = :RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION
17
17
  CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN = :CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN
18
+ RELEASE_IGNORE_BREAKING_CHANGES = :RELEASE_IGNORE_BREAKING_CHANGES
18
19
  end
19
20
 
20
21
  class AnalyzeCommitsAction < Action
@@ -137,6 +138,8 @@ module Fastlane
137
138
  ignore_scopes: params[:ignore_scopes]
138
139
  )
139
140
 
141
+ commit[:is_breaking_change] = false if params[:ignore_breaking_changes]
142
+
140
143
  next_major, next_minor, next_patch = bump_version(next_major, next_minor, next_patch, commit)
141
144
  is_next_version_compatible_with_codepush = false unless commit[:is_codepush_friendly]
142
145
 
@@ -152,6 +155,7 @@ module Fastlane
152
155
  is_next_version_releasable = Helper::SemanticReleaseHelper.semver_gt(next_version, version)
153
156
 
154
157
  Actions.lane_context[SharedValues::RELEASE_ANALYZED] = true
158
+ Actions.lane_context[SharedValues::RELEASE_IGNORE_BREAKING_CHANGES] = params[:ignore_breaking_changes]
155
159
  Actions.lane_context[SharedValues::RELEASE_IS_NEXT_VERSION_HIGHER] = is_next_version_releasable
156
160
  Actions.lane_context[SharedValues::RELEASE_IS_NEXT_VERSION_COMPATIBLE_WITH_CODEPUSH] = is_next_version_compatible_with_codepush
157
161
  Actions.lane_context[SharedValues::RELEASE_LAST_TAG_HASH] = hash
@@ -314,6 +318,13 @@ module Fastlane
314
318
  default_value: true,
315
319
  type: Boolean,
316
320
  optional: true
321
+ ),
322
+ FastlaneCore::ConfigItem.new(
323
+ key: :ignore_breaking_changes,
324
+ description: "When true, breaking changes will not trigger a major version bump",
325
+ default_value: false,
326
+ type: Boolean,
327
+ optional: true
317
328
  )
318
329
  ]
319
330
  end
@@ -45,24 +45,17 @@ module Fastlane
45
45
  end
46
46
 
47
47
  params[:order].each do |type|
48
- next if commits.none? { |commit| commit[:type] == type }
48
+ type_commits = commits.select { |commit| commit[:type] == type && !commit[:is_merge] }
49
+ next if type_commits.empty?
49
50
 
50
51
  result += "#{style_text(sections[type.to_sym], format, 'heading')}\n"
51
-
52
- commits.each do |commit|
53
- next if commit[:type] != type || commit[:is_merge]
54
-
55
- result += "-"
56
- result += " #{style_text("#{commit[:scope]}:", format, 'bold')}" unless commit[:scope].nil?
57
- result += " #{commit[:subject]}"
58
- result += " (#{build_commit_link(commit, commit_url, format)})" if params[:display_links] == true
59
- result += " - #{commit[:author_name]}" if params[:display_author]
60
- result += "\n"
61
- end
52
+ result += build_scope_lines(type_commits, format, commit_url, params)
62
53
  result += "\n"
63
54
  end
64
55
 
65
- if commits.any? { |commit| commit[:is_breaking_change] == true }
56
+ ignore_breaking = params[:ignore_breaking_changes] || lane_context[SharedValues::RELEASE_IGNORE_BREAKING_CHANGES]
57
+
58
+ if !ignore_breaking && commits.any? { |commit| commit[:is_breaking_change] == true }
66
59
  result += "#{style_text('BREAKING CHANGES', format, 'heading')}\n"
67
60
 
68
61
  commits.each do |commit|
@@ -80,6 +73,35 @@ module Fastlane
80
73
  result.rstrip!
81
74
  end
82
75
 
76
+ def self.build_scope_lines(type_commits, format, commit_url, params)
77
+ result = ""
78
+ grouped = type_commits.group_by { |commit| commit[:scope] }
79
+
80
+ grouped.each do |scope, scope_commits|
81
+ if scope.nil? || scope_commits.length == 1
82
+ scope_commits.each do |commit|
83
+ result += build_commit_line("-", commit, format, commit_url, params, include_scope: true)
84
+ end
85
+ else
86
+ result += "- #{style_text("#{scope}:", format, 'bold')}\n"
87
+ scope_commits.each do |commit|
88
+ result += build_commit_line(" -", commit, format, commit_url, params, include_scope: false)
89
+ end
90
+ end
91
+ end
92
+
93
+ result
94
+ end
95
+
96
+ def self.build_commit_line(prefix, commit, format, commit_url, params, include_scope: true)
97
+ line = prefix
98
+ line += " #{style_text("#{commit[:scope]}:", format, 'bold')}" if include_scope && !commit[:scope].nil?
99
+ line += " #{commit[:subject]}"
100
+ line += " (#{build_commit_link(commit, commit_url, format)})" if params[:display_links] == true
101
+ line += " - #{commit[:author_name]}" if params[:display_author]
102
+ "#{line}\n"
103
+ end
104
+
83
105
  def self.style_text(text, format, style)
84
106
  case style
85
107
  when "title"
@@ -240,6 +262,13 @@ module Fastlane
240
262
  default_value: false,
241
263
  type: Boolean,
242
264
  optional: true
265
+ ),
266
+ FastlaneCore::ConfigItem.new(
267
+ key: :ignore_breaking_changes,
268
+ description: "When true, breaking changes section will not appear in the changelog",
269
+ default_value: false,
270
+ type: Boolean,
271
+ optional: true
243
272
  )
244
273
  ]
245
274
  end
@@ -42,7 +42,15 @@ module Fastlane
42
42
  codepush_friendly = params[:codepush_friendly]
43
43
  pattern = params[:pattern]
44
44
 
45
- matched = commit_subject.match(pattern)
45
+ # Detect revert commits: Revert "type(scope): subject"
46
+ revert_match = commit_subject.match(/^Revert "(.+)"/i)
47
+ if revert_match
48
+ inner_subject = revert_match[1]
49
+ matched = inner_subject.match(pattern)
50
+ else
51
+ matched = commit_subject.match(pattern)
52
+ end
53
+
46
54
  result = {
47
55
  is_valid: false,
48
56
  subject: commit_subject,
@@ -54,10 +62,11 @@ module Fastlane
54
62
 
55
63
  type = matched[1].downcase
56
64
  result[:is_valid] = true
65
+ result[:is_revert] = !!revert_match
57
66
  result[:type] = type
58
67
  result[:scope] = matched[2]
59
68
  result[:has_exclamation_mark] = matched[3] == '!'
60
- result[:subject] = matched[4]
69
+ result[:subject] = revert_match ? "revert #{matched[4]}" : matched[4]
61
70
 
62
71
  if result[:has_exclamation_mark]
63
72
  result[:is_breaking_change] = true
@@ -1 +1 @@
1
- module Fastlane module SemanticRelease VERSION = "1.19.4" end end
1
+ module Fastlane module SemanticRelease VERSION = "1.22.0" end end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-semantic_release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.4
4
+ version: 1.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiří Otáhal