fastlane-plugin-better_semantic_release 2.0.1 → 2.0.4

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: 28525047c7fabef048557ba5e8a8417b2dd3df8050a4d38b77588ce4d77b07df
4
- data.tar.gz: ebccec7d9cbf6d5bef6463aacfa9eaf31575de533d1aebd3d0815a38901215ed
3
+ metadata.gz: 07f8f88f0e9ce157b5e16d2b00101b143b94390d6e0f1806a5c3942464a61718
4
+ data.tar.gz: eea2ce50bd0aef6f0b6df4aa3a403fd5198321cc5f8f38e8c3546721433fe75a
5
5
  SHA512:
6
- metadata.gz: 5fad133628c48917ed75e35800fe905fde4044dd5801da977bb4e69f3769d3ad3fa6c20c21f972cb1ba7dc944c888e33231606ed7a7509b572d561694695f54c
7
- data.tar.gz: 61fcdd48dc165ec934c2553469457c3bcf19986816cc63652305d170850fefb190dcb352ef7b8f991124d811b18009a37dad63c36aa83da740a077c9739a3ac7
6
+ metadata.gz: 0cd4041df9ed124c554f262ddfef436c4074de685bad1cf21295fe23e4bc1a1b92251eb65bc16de7eff733e51a47f35b0dfb6aa0b252613b00e868b3dc589801
7
+ data.tar.gz: 040b4d517911c0af92f27cbf56119cfb3b5ba2afc600739220bb26b1aa516eab0d7112fcaa8bb1195b2070cb78cd8b49405d5521b3f7d6dc7464d1bdbe1c86a6
@@ -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,47 @@ 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
+ parts = line.split(":")
140
+ if parts.length > 1
141
+ # conventional commits are in format
142
+ # type: subject (fix: app crash - for example)
143
+ commit = Helper::BetterSemanticReleaseHelper.parse_commit(
144
+ commit_subject: line,
145
+ commit_body: parts[1].strip,
146
+ releases: releases,
147
+ pattern: format_pattern
148
+ )
149
+
150
+ unless commit[:scope].nil?
151
+ # 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
152
+ scope = commit[:scope]
153
+ scopes_to_ignore = params[:ignore_scopes]
154
+ # if it is, we'll skip this commit when bumping versions
155
+ next if scopes_to_ignore.include?(scope) #=> true
156
+ end
140
157
 
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
158
+ if commit[:release] == "major" || commit[:is_breaking_change]
159
+ next_major += 1
160
+ next_minor = 0
161
+ next_patch = 0
162
+ elsif commit[:release] == "minor"
163
+ next_minor += 1
164
+ next_patch = 0
165
+ elsif commit[:release] == "patch"
166
+ next_patch += 1
167
+ end
148
168
 
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
169
+ unless commit[:is_codepush_friendly]
170
+ is_next_version_compatible_with_codepush = false
171
+ end
159
172
 
160
- unless commit[:is_codepush_friendly]
161
- is_next_version_compatible_with_codepush = false
173
+ next_version = "#{next_major}.#{next_minor}.#{next_patch}"
174
+ UI.message("#{next_version}") if params[:show_version_path]
175
+ end
162
176
  end
163
-
164
- next_version = "#{next_major}.#{next_minor}.#{next_patch}"
165
- UI.message("#{next_version}: #{subject}") if params[:show_version_path]
166
177
  end
167
178
 
168
179
  next_version = "#{next_major}.#{next_minor}.#{next_patch}"
@@ -188,7 +199,7 @@ module Fastlane
188
199
  end
189
200
 
190
201
  def self.is_codepush_friendly(params)
191
- git_command = 'git rev-list --max-parents=0 HEAD'
202
+ git_command = "git rev-list --max-parents=#{params[:start_hash]} HEAD"
192
203
  # Begining of the branch is taken for codepush analysis
193
204
  hash_lines = Actions.sh("#{git_command} | wc -l", log: params[:debug]).chomp
194
205
  hash = Actions.sh(git_command, log: params[:debug]).chomp
@@ -214,29 +225,34 @@ module Fastlane
214
225
 
215
226
  format_pattern = lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN]
216
227
  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
228
+ parts = line.split(':')
229
+ if parts.length > 1
230
+ # conventional commits are in format
231
+ # type: subject (fix: app crash - for example)
232
+ commit = Helper::BetterSemanticReleaseHelper.parse_commit(
233
+ commit_subject: line,
234
+ commit_body: parts[1].strip,
235
+ releases: releases,
236
+ pattern: format_pattern,
237
+ codepush_friendly: codepush_friendly
238
+ )
239
+
240
+ #UI.message commit
241
+
242
+ if commit[:release] == "major" || commit[:is_breaking_change]
243
+ next_major += 1
244
+ next_minor = 0
245
+ next_patch = 0
246
+ elsif commit[:release] == "minor"
247
+ next_minor += 1
248
+ next_patch = 0
249
+ elsif commit[:release] == "patch"
250
+ next_patch += 1
251
+ end
237
252
 
238
- unless commit[:is_codepush_friendly]
239
- last_incompatible_codepush_version = "#{next_major}.#{next_minor}.#{next_patch}"
253
+ unless commit[:is_codepush_friendly]
254
+ last_incompatible_codepush_version = "#{next_major}.#{next_minor}.#{next_patch}"
255
+ end
240
256
  end
241
257
  end
242
258
 
@@ -304,7 +320,7 @@ module Fastlane
304
320
  FastlaneCore::ConfigItem.new(
305
321
  key: :codepush_friendly,
306
322
  description: "These types are consider as codepush friendly automatically",
307
- default_value: ["chore", "test", "docs"],
323
+ default_value: ["build", "chore", "ci", "docs", "fix", "feat", "perf", "refactor", "style", "test"],
308
324
  type: Array,
309
325
  optional: true
310
326
  ),
@@ -333,6 +349,13 @@ module Fastlane
333
349
  default_value: false,
334
350
  type: Boolean,
335
351
  optional: true
352
+ ),
353
+ FastlaneCore::ConfigItem.new(
354
+ key: :start_hash,
355
+ description: "Hash to start from when calculating versions",
356
+ default_value: "HEAD",
357
+ type: String,
358
+ optional: true
336
359
  )
337
360
  ]
338
361
  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.1" end end
1
+ module Fastlane module BetterSemanticRelease VERSION = "2.0.4" 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.1
4
+ version: 2.0.4
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