fastlane-plugin-semantic_release 1.9.0 → 1.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb +61 -7
- data/lib/fastlane/plugin/semantic_release/actions/conventional_changelog.rb +3 -1
- data/lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb +11 -4
- data/lib/fastlane/plugin/semantic_release/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51884916218331bb9965b7005bdb173d6a4ce3a03fe4f348c99d495b71b8fb45
|
4
|
+
data.tar.gz: 9625cfb05fa43bd29976b9b1e345c0a2d1cfb61b49876363d57a2693a2adf4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a8a2168616e88c3a23fb8181941b8da9af9eab428b7260a7faf3ac504f812737066fb03c36ae503e4afa6fce62d31322088afe06676f97d558993e6705d559
|
7
|
+
data.tar.gz: e121b05b367d96cf315f15546957fd0dccb5c75538cd799981756a46279752d20ce6080b114f842ec9a3e09d4d9c18a5acb15a56afe04aced99b8c8921f6c15c
|
@@ -6,6 +6,7 @@ module Fastlane
|
|
6
6
|
module SharedValues
|
7
7
|
RELEASE_ANALYZED = :RELEASE_ANALYZED
|
8
8
|
RELEASE_IS_NEXT_VERSION_HIGHER = :RELEASE_IS_NEXT_VERSION_HIGHER
|
9
|
+
RELEASE_IS_NEXT_VERSION_COMPATIBLE_WITH_CODEPUSH = :RELEASE_IS_NEXT_VERSION_COMPATIBLE_WITH_CODEPUSH
|
9
10
|
RELEASE_LAST_TAG_HASH = :RELEASE_LAST_TAG_HASH
|
10
11
|
RELEASE_LAST_VERSION = :RELEASE_LAST_VERSION
|
11
12
|
RELEASE_NEXT_MAJOR_VERSION = :RELEASE_NEXT_MAJOR_VERSION
|
@@ -13,6 +14,7 @@ module Fastlane
|
|
13
14
|
RELEASE_NEXT_PATCH_VERSION = :RELEASE_NEXT_PATCH_VERSION
|
14
15
|
RELEASE_NEXT_VERSION = :RELEASE_NEXT_VERSION
|
15
16
|
RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION = :RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION
|
17
|
+
CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN = :CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN
|
16
18
|
end
|
17
19
|
|
18
20
|
class AnalyzeCommitsAction < Action
|
@@ -58,7 +60,7 @@ module Fastlane
|
|
58
60
|
else
|
59
61
|
# Tag's format is v2.3.4-5-g7685948
|
60
62
|
# See git describe man page for more info
|
61
|
-
tag_name = tag.split('-')[0].strip
|
63
|
+
tag_name = tag.split('-')[0...-2].join('-').strip
|
62
64
|
parsed_version = tag_name.match(params[:tag_version_match])
|
63
65
|
|
64
66
|
if parsed_version.nil?
|
@@ -80,6 +82,8 @@ module Fastlane
|
|
80
82
|
next_minor = (version.split('.')[1] || 0).to_i
|
81
83
|
next_patch = (version.split('.')[2] || 0).to_i
|
82
84
|
|
85
|
+
is_next_version_compatible_with_codepush = true
|
86
|
+
|
83
87
|
# Get commits log between last version and head
|
84
88
|
splitted = get_commits_from_hash(
|
85
89
|
hash: hash,
|
@@ -89,13 +93,17 @@ module Fastlane
|
|
89
93
|
UI.message("Found #{splitted.length} commits since last release")
|
90
94
|
releases = params[:releases]
|
91
95
|
|
96
|
+
format_pattern = lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN]
|
92
97
|
splitted.each do |line|
|
98
|
+
parts = line.split("|")
|
99
|
+
subject = parts[0].strip
|
93
100
|
# conventional commits are in format
|
94
101
|
# type: subject (fix: app crash - for example)
|
95
102
|
commit = Helper::SemanticReleaseHelper.parse_commit(
|
96
|
-
commit_subject:
|
97
|
-
commit_body:
|
98
|
-
releases: releases
|
103
|
+
commit_subject: subject,
|
104
|
+
commit_body: parts[1],
|
105
|
+
releases: releases,
|
106
|
+
pattern: format_pattern
|
99
107
|
)
|
100
108
|
|
101
109
|
unless commit[:scope].nil?
|
@@ -117,8 +125,12 @@ module Fastlane
|
|
117
125
|
next_patch += 1
|
118
126
|
end
|
119
127
|
|
128
|
+
unless commit[:is_codepush_friendly]
|
129
|
+
is_next_version_compatible_with_codepush = false
|
130
|
+
end
|
131
|
+
|
120
132
|
next_version = "#{next_major}.#{next_minor}.#{next_patch}"
|
121
|
-
UI.message("#{next_version}: #{
|
133
|
+
UI.message("#{next_version}: #{subject}") if params[:show_version_path]
|
122
134
|
end
|
123
135
|
|
124
136
|
next_version = "#{next_major}.#{next_minor}.#{next_patch}"
|
@@ -127,6 +139,7 @@ module Fastlane
|
|
127
139
|
|
128
140
|
Actions.lane_context[SharedValues::RELEASE_ANALYZED] = true
|
129
141
|
Actions.lane_context[SharedValues::RELEASE_IS_NEXT_VERSION_HIGHER] = is_next_version_releasable
|
142
|
+
Actions.lane_context[SharedValues::RELEASE_IS_NEXT_VERSION_COMPATIBLE_WITH_CODEPUSH] = is_next_version_compatible_with_codepush
|
130
143
|
# Last release analysis
|
131
144
|
Actions.lane_context[SharedValues::RELEASE_LAST_TAG_HASH] = hash
|
132
145
|
Actions.lane_context[SharedValues::RELEASE_LAST_VERSION] = version
|
@@ -143,13 +156,22 @@ module Fastlane
|
|
143
156
|
end
|
144
157
|
|
145
158
|
def self.is_codepush_friendly(params)
|
159
|
+
git_command = 'git rev-list --max-parents=0 HEAD'
|
146
160
|
# Begining of the branch is taken for codepush analysis
|
147
|
-
|
161
|
+
hash_lines = Actions.sh("#{git_command} | wc -l", log: params[:debug]).chomp
|
162
|
+
hash = Actions.sh(git_command, log: params[:debug]).chomp
|
148
163
|
next_major = 0
|
149
164
|
next_minor = 0
|
150
165
|
next_patch = 0
|
151
166
|
last_incompatible_codepush_version = '0.0.0'
|
152
167
|
|
168
|
+
if hash_lines.to_i > 1
|
169
|
+
UI.error("#{git_command} resulted to more than 1 hash")
|
170
|
+
UI.error('This usualy happens when you pull only part of a git history. Check out how you pull the repo! "git fetch" should be enough.')
|
171
|
+
Actions.sh(git_command, log: true).chomp
|
172
|
+
return false
|
173
|
+
end
|
174
|
+
|
153
175
|
# Get commits log between last version and head
|
154
176
|
splitted = get_commits_from_hash(
|
155
177
|
hash: hash,
|
@@ -158,6 +180,7 @@ module Fastlane
|
|
158
180
|
releases = params[:releases]
|
159
181
|
codepush_friendly = params[:codepush_friendly]
|
160
182
|
|
183
|
+
format_pattern = lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN]
|
161
184
|
splitted.each do |line|
|
162
185
|
# conventional commits are in format
|
163
186
|
# type: subject (fix: app crash - for example)
|
@@ -165,6 +188,7 @@ module Fastlane
|
|
165
188
|
commit_subject: line.split("|")[0],
|
166
189
|
commit_body: line.split("|")[1],
|
167
190
|
releases: releases,
|
191
|
+
pattern: format_pattern,
|
168
192
|
codepush_friendly: codepush_friendly
|
169
193
|
)
|
170
194
|
|
@@ -218,6 +242,27 @@ module Fastlane
|
|
218
242
|
UI.user_error!("No match for analyze_commits action given, pass using `match: 'expr'`") unless value && !value.empty?
|
219
243
|
end
|
220
244
|
),
|
245
|
+
FastlaneCore::ConfigItem.new(
|
246
|
+
key: :commit_format,
|
247
|
+
description: "The commit format to apply. Presets are 'default' or 'angular', or you can provide your own Regexp. Note: the supplied regex _must_ have 4 capture groups, in order: type, scope, has_exclamation_mark, and subject",
|
248
|
+
default_value: "default",
|
249
|
+
is_string: false,
|
250
|
+
verify_block: proc do |value|
|
251
|
+
case value
|
252
|
+
when String
|
253
|
+
unless Helper::SemanticReleaseHelper.format_patterns.key?(value)
|
254
|
+
UI.user_error!("Invalid format preset: #{value}")
|
255
|
+
end
|
256
|
+
|
257
|
+
pattern = Helper::SemanticReleaseHelper.format_patterns[value]
|
258
|
+
when Regexp
|
259
|
+
pattern = value
|
260
|
+
else
|
261
|
+
UI.user_error!("Invalid option type: #{value.inspect}")
|
262
|
+
end
|
263
|
+
Actions.lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN] = pattern
|
264
|
+
end
|
265
|
+
),
|
221
266
|
FastlaneCore::ConfigItem.new(
|
222
267
|
key: :releases,
|
223
268
|
description: "Map types of commit to release (major, minor, patch)",
|
@@ -243,6 +288,13 @@ module Fastlane
|
|
243
288
|
type: Array,
|
244
289
|
optional: true
|
245
290
|
),
|
291
|
+
FastlaneCore::ConfigItem.new(
|
292
|
+
key: :show_version_path,
|
293
|
+
description: "True if you want to print out the version calculated for each commit",
|
294
|
+
default_value: true,
|
295
|
+
type: Boolean,
|
296
|
+
optional: true
|
297
|
+
),
|
246
298
|
FastlaneCore::ConfigItem.new(
|
247
299
|
key: :debug,
|
248
300
|
description: "True if you want to log out a debug info",
|
@@ -259,13 +311,15 @@ module Fastlane
|
|
259
311
|
[
|
260
312
|
['RELEASE_ANALYZED', 'True if commits were analyzed.'],
|
261
313
|
['RELEASE_IS_NEXT_VERSION_HIGHER', 'True if next version is higher then last version'],
|
314
|
+
['RELEASE_IS_NEXT_VERSION_COMPATIBLE_WITH_CODEPUSH', 'True if next version is compatible with codepush'],
|
262
315
|
['RELEASE_LAST_TAG_HASH', 'Hash of commit that is tagged as a last version'],
|
263
316
|
['RELEASE_LAST_VERSION', 'Last version number - parsed from last tag.'],
|
264
317
|
['RELEASE_NEXT_MAJOR_VERSION', 'Major number of the next version'],
|
265
318
|
['RELEASE_NEXT_MINOR_VERSION', 'Minor number of the next version'],
|
266
319
|
['RELEASE_NEXT_PATCH_VERSION', 'Patch number of the next version'],
|
267
320
|
['RELEASE_NEXT_VERSION', 'Next version string in format (major.minor.patch)'],
|
268
|
-
['RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION', 'Last commit without codepush']
|
321
|
+
['RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION', 'Last commit without codepush'],
|
322
|
+
['CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN', 'The format pattern Regexp used to match commits (mainly for internal use)']
|
269
323
|
]
|
270
324
|
end
|
271
325
|
|
@@ -175,12 +175,14 @@ module Fastlane
|
|
175
175
|
def self.parse_commits(commits)
|
176
176
|
parsed = []
|
177
177
|
# %s|%b|%H|%h|%an|%at
|
178
|
+
format_pattern = lane_context[SharedValues::CONVENTIONAL_CHANGELOG_ACTION_FORMAT_PATTERN]
|
178
179
|
commits.each do |line|
|
179
180
|
splitted = line.split("|")
|
180
181
|
|
181
182
|
commit = Helper::SemanticReleaseHelper.parse_commit(
|
182
183
|
commit_subject: splitted[0],
|
183
|
-
commit_body: splitted[1]
|
184
|
+
commit_body: splitted[1],
|
185
|
+
pattern: format_pattern
|
184
186
|
)
|
185
187
|
|
186
188
|
commit[:hash] = splitted[2]
|
@@ -5,6 +5,13 @@ module Fastlane
|
|
5
5
|
|
6
6
|
module Helper
|
7
7
|
class SemanticReleaseHelper
|
8
|
+
def self.format_patterns
|
9
|
+
return {
|
10
|
+
"default" => /^(docs|fix|feat|chore|style|refactor|perf|test)(?:\((.*)\))?(!?)\: (.*)/,
|
11
|
+
"angular" => /^(\w*)(?:\((.*)\))?(): (.*)/
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
8
15
|
# class methods that you define here become available in your action
|
9
16
|
# as `Helper::SemanticReleaseHelper.your_method`
|
10
17
|
#
|
@@ -18,7 +25,7 @@ module Fastlane
|
|
18
25
|
commit_body = params[:commit_body]
|
19
26
|
releases = params[:releases]
|
20
27
|
codepush_friendly = params[:codepush_friendly]
|
21
|
-
pattern =
|
28
|
+
pattern = params[:pattern]
|
22
29
|
breaking_change_pattern = /BREAKING CHANGES?: (.*)/
|
23
30
|
codepush_pattern = /codepush?: (.*)/
|
24
31
|
|
@@ -32,13 +39,13 @@ module Fastlane
|
|
32
39
|
|
33
40
|
unless matched.nil?
|
34
41
|
type = matched[1]
|
35
|
-
scope = matched[
|
42
|
+
scope = matched[2]
|
36
43
|
|
37
44
|
result[:is_valid] = true
|
38
45
|
result[:type] = type
|
39
46
|
result[:scope] = scope
|
40
|
-
result[:has_exclamation_mark] = matched[
|
41
|
-
result[:subject] = matched[
|
47
|
+
result[:has_exclamation_mark] = matched[3] == '!'
|
48
|
+
result[:subject] = matched[4]
|
42
49
|
|
43
50
|
unless releases.nil?
|
44
51
|
result[:release] = releases[type.to_sym]
|
@@ -1 +1 @@
|
|
1
|
-
module Fastlane module SemanticRelease VERSION = "1.
|
1
|
+
module Fastlane module SemanticRelease VERSION = "1.13.1" end end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-semantic_release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jiří Otáhal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|