fastlane-plugin-better_semantic_release 2.0.0 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06b894d93bb8feb99debdfd5adea20ffde9bc1ad9650904e6b367d07c9235b5a
4
- data.tar.gz: faee92c7674d3d4a29faa05388af8f3175b7784906908277ab03e19b5489ca2e
3
+ metadata.gz: 341589aa015b10e3fd18cd7fb26c82bd2dffddeee287f3b60b0ae1daff092cb5
4
+ data.tar.gz: a3130fdb916f361a3d61b3712551b3d3aa24976f6a416b01dd04e7d9eeb93ff1
5
5
  SHA512:
6
- metadata.gz: 5dae794075a53839ba8a362b7f04dcc210117c565493f3d625605ffbca965e57f3e8c8a0d96d5ab3c024cd84e5cb2895991f4c294137d92cd6beef1d85224c6b
7
- data.tar.gz: bfa85dcde07d747095d74d7d79ab1e8081e78ae9b03484cf9c17c95fb8bd4a878f97271991144f8d6cc1c21200bd1805acb8140058536a5a4e41df3103f1d419
6
+ metadata.gz: b35e90d226aa36105a48c41556fadcf934e7de7c774add9b936a8d73ffe9104830915fcebd46a6ffec9b49a1c9c7c114e1cd7bfa1c0b15e0c7825ff2415d9f12
7
+ data.tar.gz: 0c7226e613d3fb258b454f305f157a4e6f01db25b7d076db2c0f0fc13579109fd49015b9000d478a0d323d056a2c63592857db5eb1949b81bce99da503f5358c
@@ -28,8 +28,16 @@ module Fastlane
28
28
  end
29
29
 
30
30
  def self.get_last_tag_hash(params)
31
- command = "git rev-list -n 1 refs/tags/#{params[:tag_name]}"
32
- Actions.sh(command, log: params[:debug]).chomp
31
+ #command = "git rev-list -n 1 refs/tags/#{params[:tag_name]}"
32
+ #Actions.sh(command, log: params[:debug]).chomp
33
+
34
+ command = "git log -2 --pretty=format:'%H' #{params[:tag_name]}"
35
+ command_output = Actions.sh(command, log: false).chomp
36
+ hashes = command_output.split("\n")
37
+ if hashes.length > 1
38
+ return hashes[1]
39
+ end
40
+ return nil
33
41
  end
34
42
 
35
43
  def self.get_commits_from_hash(params)
@@ -42,15 +50,14 @@ module Fastlane
42
50
  end
43
51
 
44
52
  def self.get_beginning_of_next_sprint(params)
45
- # command to get first commit
46
- git_command = 'git rev-list --max-parents=0 HEAD'
47
-
48
53
  tag = get_last_tag(match: params[:match], debug: params[:debug])
49
54
 
50
55
  # if tag doesn't exist it get's first commit or fallback tag (v*.*.*)
51
56
  if tag.empty?
52
57
  UI.message("It couldn't match tag for #{params[:match]}. Check if first commit can be taken as a beginning of next release")
53
58
  # If there is no tag found we taking the first commit of current branch
59
+ # command to get first commit
60
+ git_command = 'git rev-list --max-parents=0 HEAD'
54
61
  hash_lines = Actions.sh("#{git_command} | wc -l", log: params[:debug]).chomp
55
62
 
56
63
  if hash_lines.to_i == 1
@@ -126,43 +133,44 @@ module Fastlane
126
133
  releases = params[:releases]
127
134
 
128
135
  format_pattern = lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN]
129
- splitted.each do |line|
130
- parts = line.split("|")
131
- subject = parts[0].strip
132
- # conventional commits are in format
133
- # type: subject (fix: app crash - for example)
134
- commit = Helper::BetterSemanticReleaseHelper.parse_commit(
135
- commit_subject: subject,
136
- commit_body: parts[1],
137
- releases: releases,
138
- pattern: format_pattern
139
- )
136
+ splitted.each do |squashed_commit|
137
+ commits = squashed_commit.split("*")
138
+ commits.drop(1).each do |line|
139
+ # conventional commits are in format
140
+ # type: subject (fix: app crash - for example)
141
+ commit = Helper::BetterSemanticReleaseHelper.parse_commit(
142
+ commit_subject: line,
143
+ commit_body: line.split(":")[1].strip,
144
+ releases: releases,
145
+ pattern: format_pattern
146
+ )
147
+
148
+ unless commit[:scope].nil?
149
+ # if this commit has a scope, then we need to inspect to see if that is one of the scopes we're trying to exclude
150
+ scope = commit[:scope]
151
+ scopes_to_ignore = params[:ignore_scopes]
152
+ # if it is, we'll skip this commit when bumping versions
153
+ next if scopes_to_ignore.include?(scope) #=> true
154
+ end
140
155
 
141
- unless commit[:scope].nil?
142
- # if this commit has a scope, then we need to inspect to see if that is one of the scopes we're trying to exclude
143
- scope = commit[:scope]
144
- scopes_to_ignore = params[:ignore_scopes]
145
- # if it is, we'll skip this commit when bumping versions
146
- next if scopes_to_ignore.include?(scope) #=> true
147
- end
156
+ if commit[:release] == "major" || commit[:is_breaking_change]
157
+ next_major += 1
158
+ next_minor = 0
159
+ next_patch = 0
160
+ elsif commit[:release] == "minor"
161
+ next_minor += 1
162
+ next_patch = 0
163
+ elsif commit[:release] == "patch"
164
+ next_patch += 1
165
+ end
148
166
 
149
- if commit[:release] == "major" || commit[:is_breaking_change]
150
- next_major += 1
151
- next_minor = 0
152
- next_patch = 0
153
- elsif commit[:release] == "minor"
154
- next_minor += 1
155
- next_patch = 0
156
- elsif commit[:release] == "patch"
157
- next_patch += 1
158
- end
167
+ unless commit[:is_codepush_friendly]
168
+ is_next_version_compatible_with_codepush = false
169
+ end
159
170
 
160
- unless commit[:is_codepush_friendly]
161
- is_next_version_compatible_with_codepush = false
171
+ next_version = "#{next_major}.#{next_minor}.#{next_patch}"
172
+ UI.message("#{next_version}") if params[:show_version_path]
162
173
  end
163
-
164
- next_version = "#{next_major}.#{next_minor}.#{next_patch}"
165
- UI.message("#{next_version}: #{subject}") if params[:show_version_path]
166
174
  end
167
175
 
168
176
  next_version = "#{next_major}.#{next_minor}.#{next_patch}"
@@ -188,7 +196,7 @@ module Fastlane
188
196
  end
189
197
 
190
198
  def self.is_codepush_friendly(params)
191
- git_command = 'git rev-list --max-parents=0 HEAD'
199
+ git_command = "git rev-list --max-parents=#{params[:start_hash]} HEAD"
192
200
  # Begining of the branch is taken for codepush analysis
193
201
  hash_lines = Actions.sh("#{git_command} | wc -l", log: params[:debug]).chomp
194
202
  hash = Actions.sh(git_command, log: params[:debug]).chomp
@@ -214,29 +222,34 @@ module Fastlane
214
222
 
215
223
  format_pattern = lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN]
216
224
  splitted.each do |line|
217
- # conventional commits are in format
218
- # type: subject (fix: app crash - for example)
219
- commit = Helper::BetterSemanticReleaseHelper.parse_commit(
220
- commit_subject: line.split("|")[0],
221
- commit_body: line.split("|")[1],
222
- releases: releases,
223
- pattern: format_pattern,
224
- codepush_friendly: codepush_friendly
225
- )
226
-
227
- if commit[:release] == "major" || commit[:is_breaking_change]
228
- next_major += 1
229
- next_minor = 0
230
- next_patch = 0
231
- elsif commit[:release] == "minor"
232
- next_minor += 1
233
- next_patch = 0
234
- elsif commit[:release] == "patch"
235
- next_patch += 1
236
- end
225
+ parts = line.split(':')
226
+ if parts.length > 1
227
+ # conventional commits are in format
228
+ # type: subject (fix: app crash - for example)
229
+ commit = Helper::BetterSemanticReleaseHelper.parse_commit(
230
+ commit_subject: line,
231
+ commit_body: parts[1].strip,
232
+ releases: releases,
233
+ pattern: format_pattern,
234
+ codepush_friendly: codepush_friendly
235
+ )
236
+
237
+ #UI.message commit
238
+
239
+ if commit[:release] == "major" || commit[:is_breaking_change]
240
+ next_major += 1
241
+ next_minor = 0
242
+ next_patch = 0
243
+ elsif commit[:release] == "minor"
244
+ next_minor += 1
245
+ next_patch = 0
246
+ elsif commit[:release] == "patch"
247
+ next_patch += 1
248
+ end
237
249
 
238
- unless commit[:is_codepush_friendly]
239
- last_incompatible_codepush_version = "#{next_major}.#{next_minor}.#{next_patch}"
250
+ unless commit[:is_codepush_friendly]
251
+ last_incompatible_codepush_version = "#{next_major}.#{next_minor}.#{next_patch}"
252
+ end
240
253
  end
241
254
  end
242
255
 
@@ -304,7 +317,7 @@ module Fastlane
304
317
  FastlaneCore::ConfigItem.new(
305
318
  key: :codepush_friendly,
306
319
  description: "These types are consider as codepush friendly automatically",
307
- default_value: ["chore", "test", "docs"],
320
+ default_value: ["build", "chore", "ci", "docs", "fix", "feat", "perf", "refactor", "style", "test"],
308
321
  type: Array,
309
322
  optional: true
310
323
  ),
@@ -333,6 +346,13 @@ module Fastlane
333
346
  default_value: false,
334
347
  type: Boolean,
335
348
  optional: true
349
+ ),
350
+ FastlaneCore::ConfigItem.new(
351
+ key: :start_hash,
352
+ description: "Hash to start from when calculating versions",
353
+ default_value: "HEAD",
354
+ type: String,
355
+ optional: true
336
356
  )
337
357
  ]
338
358
  end
@@ -34,7 +34,8 @@ module Fastlane
34
34
  is_valid: false,
35
35
  subject: commit_subject,
36
36
  is_merge: !(commit_subject =~ /^Merge/).nil?,
37
- type: 'no_type'
37
+ type: 'no_type',
38
+ is_codepush_friendly: true
38
39
  }
39
40
 
40
41
  unless matched.nil?
@@ -1 +1 @@
1
- module Fastlane module BetterSemanticRelease VERSION = "2.0.0" end end
1
+ module Fastlane module BetterSemanticRelease VERSION = "2.0.3" end end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-better_semantic_release
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Greco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-06 00:00:00.000000000 Z
11
+ date: 2022-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -144,11 +144,11 @@ extra_rdoc_files: []
144
144
  files:
145
145
  - LICENSE
146
146
  - README.md
147
+ - lib/fastlane/plugin/better_semantic_release.rb
147
148
  - lib/fastlane/plugin/better_semantic_release/actions/analyze_commits.rb
148
149
  - lib/fastlane/plugin/better_semantic_release/actions/conventional_changelog.rb
149
- - lib/fastlane/plugin/better_semantic_release/helper/semantic_release_helper.rb
150
+ - lib/fastlane/plugin/better_semantic_release/helper/better_semantic_release_helper.rb
150
151
  - lib/fastlane/plugin/better_semantic_release/version.rb
151
- - lib/fastlane/plugin/semantic_release.rb
152
152
  homepage: https://github.com/tomgreco/fastlane-plugin-better_semantic_release
153
153
  licenses:
154
154
  - MIT