fastlane-plugin-semantic_release 1.22.0 → 1.24.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: 2ca1b0eb20fc15eda85dd48a0e4b6f5aadf4a8ed70fea7e0747d9b7f6eaf305b
4
- data.tar.gz: b768e8adae79e696ae6d5ebde4d32e946807f15047d71fba93acc83043e051b2
3
+ metadata.gz: ad03607f022aa71c63febcd0e39df20a5154fb695ce5fb2267c7351b51692d41
4
+ data.tar.gz: d3b1a4584e3bf3c83e3d1f0ae6113025577f83c5a0404579719308b17f16c97e
5
5
  SHA512:
6
- metadata.gz: 7db91c64c0ca78c7981202f543e898ef035931e3756791b7a60ccb15b451065411e94d32f8c044c18b5fa1f522ef18a3773e189097776238df5314e105c13524
7
- data.tar.gz: f3bfa66b06e45476815cbdd39b487ee5ea2418c20795b6fca8f68e12e0d3290802f3a8f8297cd196b37bce1548c0b3e5d1f94eb644597d7016927db45f81d3a4
6
+ metadata.gz: 41062aa1f48bd470a6a925abdcbe55b59dd10f8fbb39268cca4f810d056f4d003dadd5b90a2d05f6026a9a6d29ec65f3676bc37fce47966613ddb26dd3b96b76
7
+ data.tar.gz: ed6f38210180f3906214c020f163aba80828f15fb068dfa75a99e511b5d5be0b15a3d7514c89408febe03d24174cd837b80c1bb973eecd114f1aeaf0323edc4d
@@ -16,6 +16,7 @@ module Fastlane
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
18
  RELEASE_IGNORE_BREAKING_CHANGES = :RELEASE_IGNORE_BREAKING_CHANGES
19
+ RELEASE_DRY_RUN = :RELEASE_DRY_RUN
19
20
  end
20
21
 
21
22
  class AnalyzeCommitsAction < Action
@@ -120,6 +121,7 @@ module Fastlane
120
121
  commits = get_commits_from_hash(hash: hash, debug: params[:debug])
121
122
  UI.message("Found #{commits.length} commits since last release")
122
123
 
124
+ parsed_commits = []
123
125
  format_pattern = lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN]
124
126
  commits.each do |line|
125
127
  parts = line.split("|")
@@ -140,6 +142,7 @@ module Fastlane
140
142
 
141
143
  commit[:is_breaking_change] = false if params[:ignore_breaking_changes]
142
144
 
145
+ parsed_commits.push(commit)
143
146
  next_major, next_minor, next_patch = bump_version(next_major, next_minor, next_patch, commit)
144
147
  is_next_version_compatible_with_codepush = false unless commit[:is_codepush_friendly]
145
148
 
@@ -164,10 +167,13 @@ module Fastlane
164
167
  Actions.lane_context[SharedValues::RELEASE_NEXT_MINOR_VERSION] = next_minor
165
168
  Actions.lane_context[SharedValues::RELEASE_NEXT_PATCH_VERSION] = next_patch
166
169
  Actions.lane_context[SharedValues::RELEASE_NEXT_VERSION] = next_version
170
+ Actions.lane_context[SharedValues::RELEASE_DRY_RUN] = params[:dry_run]
167
171
 
168
172
  success_message = "Next version (#{next_version}) is higher than last version (#{version}). This version should be released."
169
173
  UI.success(success_message) if is_next_version_releasable
170
174
 
175
+ Helper::SemanticReleaseHelper.print_dry_run_summary(version, next_version, parsed_commits) if params[:dry_run]
176
+
171
177
  is_next_version_releasable
172
178
  end
173
179
 
@@ -325,6 +331,13 @@ module Fastlane
325
331
  default_value: false,
326
332
  type: Boolean,
327
333
  optional: true
334
+ ),
335
+ FastlaneCore::ConfigItem.new(
336
+ key: :dry_run,
337
+ description: "When true, prints a release summary. All shared values are still set so conventional_changelog can preview notes",
338
+ default_value: false,
339
+ type: Boolean,
340
+ optional: true
328
341
  )
329
342
  ]
330
343
  end
@@ -341,7 +354,8 @@ module Fastlane
341
354
  ['RELEASE_NEXT_PATCH_VERSION', 'Patch number of the next version'],
342
355
  ['RELEASE_NEXT_VERSION', 'Next version string in format (major.minor.patch)'],
343
356
  ['RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION', 'Last commit without codepush'],
344
- ['CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN', 'The format pattern Regexp used to match commits (mainly for internal use)']
357
+ ['CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN', 'The format pattern Regexp used to match commits (mainly for internal use)'],
358
+ ['RELEASE_DRY_RUN', 'True if this was a dry run analysis']
345
359
  ]
346
360
  end
347
361
 
@@ -34,6 +34,14 @@ module Fastlane
34
34
 
35
35
  def self.note_builder(format, commits, version, commit_url, params)
36
36
  sections = params[:sections]
37
+ order = params[:order].dup
38
+
39
+ # Auto-add any section keys not already in order
40
+ sections.each_key do |type_sym|
41
+ type_str = type_sym.to_s
42
+ order.push(type_str) unless order.include?(type_str)
43
+ end
44
+
37
45
  result = ""
38
46
 
39
47
  if params[:display_title] == true
@@ -44,11 +52,12 @@ module Fastlane
44
52
  result = "#{style_text(title, format, 'title')}\n\n"
45
53
  end
46
54
 
47
- params[:order].each do |type|
55
+ order.each do |type|
48
56
  type_commits = commits.select { |commit| commit[:type] == type && !commit[:is_merge] }
49
57
  next if type_commits.empty?
50
58
 
51
- result += "#{style_text(sections[type.to_sym], format, 'heading')}\n"
59
+ heading = sections[type.to_sym] || type.capitalize
60
+ result += "#{style_text(heading, format, 'heading')}\n"
52
61
  result += build_scope_lines(type_commits, format, commit_url, params)
53
62
  result += "\n"
54
63
  end
@@ -201,7 +210,7 @@ module Fastlane
201
210
  FastlaneCore::ConfigItem.new(
202
211
  key: :order,
203
212
  description: "You can change the order of groups in release notes",
204
- default_value: ["feat", "fix", "refactor", "perf", "chore", "test", "docs", "no_type"],
213
+ default_value: ["feat", "fix", "refactor", "perf", "build", "ci", "style", "chore", "test", "docs", "no_type"],
205
214
  type: Array,
206
215
  optional: true
207
216
  ),
@@ -213,6 +222,9 @@ module Fastlane
213
222
  fix: "Bug fixes",
214
223
  refactor: "Code refactoring",
215
224
  perf: "Performance improvements",
225
+ build: "Build system",
226
+ ci: "CI/CD",
227
+ style: "Code style",
216
228
  chore: "Building system",
217
229
  test: "Testing",
218
230
  docs: "Documentation",
@@ -6,8 +6,8 @@ module Fastlane
6
6
  module Helper
7
7
  class SemanticReleaseHelper
8
8
  FORMAT_PATTERNS = {
9
- "default" => /^(docs|fix|feat|chore|style|refactor|perf|test)(?:\((.*)\))?(!?): (.*)/i,
10
- "angular" => /^(\w*)(?:\((.*)\))?(): (.*)/
9
+ "default" => /^(\w+)(?:\((.*)\))?(!?): (.*)/i,
10
+ "angular" => /^(\w*)(?:\((.*)\))?(!?): (.*)/
11
11
  }.freeze
12
12
 
13
13
  def self.format_patterns
@@ -93,6 +93,43 @@ module Fastlane
93
93
  def self.semver_gt(first, second)
94
94
  (parse_semver(first) <=> parse_semver(second)) == 1
95
95
  end
96
+
97
+ def self.determine_bump_type(version, next_version)
98
+ old_parts = parse_semver(version)
99
+ new_parts = parse_semver(next_version)
100
+
101
+ if new_parts[0] > old_parts[0]
102
+ "major"
103
+ elsif new_parts[1] > old_parts[1]
104
+ "minor"
105
+ elsif new_parts[2] > old_parts[2]
106
+ "patch"
107
+ else
108
+ "none"
109
+ end
110
+ end
111
+
112
+ def self.print_dry_run_summary(version, next_version, parsed_commits)
113
+ bump_type = determine_bump_type(version, next_version)
114
+
115
+ UI.important("--- DRY RUN: Release Analysis Summary ---")
116
+ UI.message("Current version: #{version}")
117
+ UI.message("Next version: #{next_version} (#{bump_type})")
118
+
119
+ type_counts = Hash.new(0)
120
+ parsed_commits.each { |c| type_counts[c[:type]] += 1 }
121
+
122
+ UI.message("Commits analyzed: #{parsed_commits.length}")
123
+ type_counts.each { |type, count| UI.message(" #{type}: #{count}") }
124
+
125
+ UI.message("Commits included in this release:")
126
+ parsed_commits.each do |commit|
127
+ scope_part = commit[:scope] ? "(#{commit[:scope]})" : ""
128
+ UI.message(" - #{commit[:type]}#{scope_part}: #{commit[:subject]}")
129
+ end
130
+
131
+ UI.important("--- End of Dry Run ---")
132
+ end
96
133
  end
97
134
  end
98
135
  end
@@ -1 +1 @@
1
- module Fastlane module SemanticRelease VERSION = "1.22.0" end end
1
+ module Fastlane module SemanticRelease VERSION = "1.24.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.22.0
4
+ version: 1.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiří Otáhal