fastlane-plugin-better_semantic_release 1.0.0 → 2.0.2
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/lib/fastlane/plugin/better_semantic_release/actions/analyze_commits.rb +82 -62
- data/lib/fastlane/plugin/better_semantic_release/helper/{semantic_release_helper.rb → better_semantic_release_helper.rb} +4 -3
- data/lib/fastlane/plugin/better_semantic_release/version.rb +1 -1
- data/lib/fastlane/plugin/{semantic_release.rb → better_semantic_release.rb} +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07acfe8333f8d51d614bf67934dcce916dc921ab6430cf847b733ca9c1720079
|
4
|
+
data.tar.gz: 3d06659fa89cb3550264af43d2be11a76bf324d116289d3fa0319f38dd61a298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a6640db9100bde01932fcda01e0f0d918d5c38f923707475f04bb9ff0548b03d1ae54e218b6d1129baffa4ae2357be3e24a5444c4a4a49e9211c4e434881ba6
|
7
|
+
data.tar.gz: 7e7f49b2afbfdcb8583fc2fe72dd4b8b97e7b96ad411e3e2c219f55d4c88328f2481d54d7214d621a39b82b816c689b3f810a0da36a7b10e7979bf615ce9b30f
|
@@ -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 |
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
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
|
-
|
150
|
-
|
151
|
-
|
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
|
-
|
161
|
-
|
171
|
+
next_version = "#{next_major}.#{next_minor}.#{next_patch}"
|
172
|
+
UI.message("#{next_version}: #{subject}") 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 =
|
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
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
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
|
-
|
239
|
-
|
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", "
|
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
|
@@ -4,7 +4,7 @@ module Fastlane
|
|
4
4
|
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
5
|
|
6
6
|
module Helper
|
7
|
-
class
|
7
|
+
class BetterSemanticReleaseHelper
|
8
8
|
def self.format_patterns
|
9
9
|
return {
|
10
10
|
"default" => /^(docs|fix|feat|chore|style|refactor|perf|test)(?:\((.*)\))?(!?)\: (.*)/,
|
@@ -13,7 +13,7 @@ module Fastlane
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# class methods that you define here become available in your action
|
16
|
-
# as `Helper::
|
16
|
+
# as `Helper::BetterSemanticReleaseHelper.your_method`
|
17
17
|
#
|
18
18
|
def self.git_log(params)
|
19
19
|
command = "git log --pretty='#{params[:pretty]}' --reverse #{params[:start]}..HEAD"
|
@@ -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 = "
|
1
|
+
module Fastlane module BetterSemanticRelease VERSION = "2.0.2" end end
|
File without changes
|
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:
|
4
|
+
version: 2.0.2
|
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-
|
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/
|
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
|