fastlane-plugin-semantic_release 1.0.10 → 1.1.0
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 +6 -33
- data/lib/fastlane/plugin/semantic_release/actions/conventional_changelog.rb +78 -24
- data/lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb +43 -0
- data/lib/fastlane/plugin/semantic_release/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeb35e46cb525cfd276c6a00e9c7728e2c3ada68be25635c3985cf81ed3f26f8
|
4
|
+
data.tar.gz: eb1193bcbdc76425e87522ccb167b093de60e2ac5c1f26e48f752e3930f5acbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af63de182b4b1f0acac3fd30f8ee1f50bad6257ed086466c15b587482ad47fe64a70c84eef79af0604a3fbca29e3712421cb691e9b75c560dd1c53df1863ebf5
|
7
|
+
data.tar.gz: 2d2cccf19624829ed04bde556158208eb6e8b156bbfa5b37737b9eaca2d90608c57175b491547e4512dcc96f62d60428a1070062e5232d1f2a627c50d6dde337
|
@@ -29,41 +29,10 @@ module Fastlane
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.get_commits_from_hash(params)
|
32
|
-
commits = Helper::SemanticReleaseHelper.git_log('%s', params[:hash])
|
32
|
+
commits = Helper::SemanticReleaseHelper.git_log('%s|%b', params[:hash])
|
33
33
|
commits.split("\n")
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.parse_commit(params)
|
37
|
-
commit = params[:commit]
|
38
|
-
releases = params[:releases]
|
39
|
-
pattern = /(docs|fix|feat|chore|style|refactor|perf|test)(\((.*)\))?!?\: /
|
40
|
-
breaking_change_pattern = /BREAKING CHANGES?: (.*)/
|
41
|
-
|
42
|
-
matched = commit.match(pattern)
|
43
|
-
result = {
|
44
|
-
is_valid: false
|
45
|
-
}
|
46
|
-
|
47
|
-
unless matched.nil?
|
48
|
-
type = matched[1]
|
49
|
-
scope = matched[3]
|
50
|
-
|
51
|
-
result[:is_valid] = true
|
52
|
-
result[:type] = type
|
53
|
-
result[:scope] = scope
|
54
|
-
result[:release] = releases[type.to_sym]
|
55
|
-
|
56
|
-
breaking_change_matched = commit.match(breaking_change_pattern)
|
57
|
-
|
58
|
-
unless breaking_change_matched.nil?
|
59
|
-
result[:is_breaking_change] = true
|
60
|
-
result[:breaking_change] = breaking_change_matched[1]
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
result
|
65
|
-
end
|
66
|
-
|
67
36
|
def self.run(params)
|
68
37
|
# Hash of the commit where is the last version
|
69
38
|
# If the tag is not found we are taking HEAD as reference
|
@@ -108,7 +77,11 @@ module Fastlane
|
|
108
77
|
splitted.each do |line|
|
109
78
|
# conventional commits are in format
|
110
79
|
# type: subject (fix: app crash - for example)
|
111
|
-
commit = parse_commit(
|
80
|
+
commit = Helper::SemanticReleaseHelper.parse_commit(
|
81
|
+
commit_subject: line.split("|")[0],
|
82
|
+
commit_body: line.split("|")[1],
|
83
|
+
releases: releases
|
84
|
+
)
|
112
85
|
|
113
86
|
if commit[:release] == "major" || commit[:is_breaking_change]
|
114
87
|
next_major += 1
|
@@ -7,6 +7,11 @@ module Fastlane
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class ConventionalChangelogAction < Action
|
10
|
+
def self.get_commits_from_hash(params)
|
11
|
+
commits = Helper::SemanticReleaseHelper.git_log('%s%b|%H|%h|%an|%at', params[:hash])
|
12
|
+
commits.split("\n")
|
13
|
+
end
|
14
|
+
|
10
15
|
def self.run(params)
|
11
16
|
# Get next version number from shared values
|
12
17
|
analyzed = lane_context[SharedValues::RELEASE_ANALYZED]
|
@@ -22,8 +27,8 @@ module Fastlane
|
|
22
27
|
version = lane_context[SharedValues::RELEASE_NEXT_VERSION]
|
23
28
|
|
24
29
|
# Get commits log between last version and head
|
25
|
-
commits =
|
26
|
-
parsed = parse_commits(commits
|
30
|
+
commits = get_commits_from_hash(hash: last_tag_hash)
|
31
|
+
parsed = parse_commits(commits)
|
27
32
|
|
28
33
|
commit_url = params[:commit_url]
|
29
34
|
|
@@ -55,14 +60,43 @@ module Fastlane
|
|
55
60
|
result += "\n"
|
56
61
|
|
57
62
|
commits.each do |commit|
|
58
|
-
next if commit[:type] != type
|
63
|
+
next if commit[:type] != type || commit[:is_merge]
|
59
64
|
|
60
65
|
author_name = commit[:author_name]
|
61
66
|
short_hash = commit[:short_hash]
|
62
67
|
hash = commit[:hash]
|
63
68
|
link = "#{commit_url}/#{hash}"
|
64
69
|
|
65
|
-
result += "-
|
70
|
+
result += "-"
|
71
|
+
|
72
|
+
unless commit[:scope].nil?
|
73
|
+
result += " **#{commit[:scope]}:**"
|
74
|
+
end
|
75
|
+
|
76
|
+
result += " #{commit[:subject]} ([#{short_hash}](#{link}))"
|
77
|
+
|
78
|
+
if params[:display_author]
|
79
|
+
result += "- #{author_name}"
|
80
|
+
end
|
81
|
+
|
82
|
+
result += "\n"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
if commits.any? { |commit| commit[:is_breaking_change] == true }
|
87
|
+
result += "\n\n"
|
88
|
+
result += "### BREAKING CHANGES"
|
89
|
+
result += "\n"
|
90
|
+
|
91
|
+
commits.each do |commit|
|
92
|
+
next unless commit[:is_breaking_change]
|
93
|
+
|
94
|
+
author_name = commit[:author_name]
|
95
|
+
short_hash = commit[:short_hash]
|
96
|
+
hash = commit[:hash]
|
97
|
+
link = "#{commit_url}/#{hash}"
|
98
|
+
|
99
|
+
result += "- #{commit[:breaking_change]} ([#{short_hash}](#{link}))"
|
66
100
|
|
67
101
|
if params[:display_author]
|
68
102
|
result += "- #{author_name}"
|
@@ -91,14 +125,43 @@ module Fastlane
|
|
91
125
|
result += "\n"
|
92
126
|
|
93
127
|
commits.each do |commit|
|
94
|
-
next if commit[:type] != type
|
128
|
+
next if commit[:type] != type || commit[:is_merge]
|
95
129
|
|
96
130
|
author_name = commit[:author_name]
|
97
131
|
short_hash = commit[:short_hash]
|
98
132
|
hash = commit[:hash]
|
99
133
|
link = "#{commit_url}/#{hash}"
|
100
134
|
|
101
|
-
result += "-
|
135
|
+
result += "-"
|
136
|
+
|
137
|
+
unless commit[:scope].nil?
|
138
|
+
result += " *#{commit[:scope]}:*"
|
139
|
+
end
|
140
|
+
|
141
|
+
result += " #{commit[:subject]} (<#{link}|#{short_hash}>)"
|
142
|
+
|
143
|
+
if params[:display_author]
|
144
|
+
result += "- #{author_name}"
|
145
|
+
end
|
146
|
+
|
147
|
+
result += "\n"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
if commits.any? { |commit| commit[:is_breaking_change] == true }
|
152
|
+
result += "\n\n"
|
153
|
+
result += "*BREAKING CHANGES*"
|
154
|
+
result += "\n"
|
155
|
+
|
156
|
+
commits.each do |commit|
|
157
|
+
next unless commit[:is_breaking_change]
|
158
|
+
|
159
|
+
author_name = commit[:author_name]
|
160
|
+
short_hash = commit[:short_hash]
|
161
|
+
hash = commit[:hash]
|
162
|
+
link = "#{commit_url}/#{hash}"
|
163
|
+
|
164
|
+
result += "- #{commit[:breaking_change]} (<#{link}|#{short_hash}>)"
|
102
165
|
|
103
166
|
if params[:display_author]
|
104
167
|
result += "- #{author_name}"
|
@@ -113,28 +176,19 @@ module Fastlane
|
|
113
176
|
|
114
177
|
def self.parse_commits(commits)
|
115
178
|
parsed = []
|
116
|
-
# %s|%H|%h|%an|%at
|
179
|
+
# %s|%b|%H|%h|%an|%at
|
117
180
|
commits.each do |line|
|
118
181
|
splitted = line.split("|")
|
119
182
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
subject = subject_splitted[1]
|
125
|
-
else
|
126
|
-
type = 'no_type'
|
127
|
-
subject = subject_splitted[0]
|
128
|
-
end
|
183
|
+
commit = Helper::SemanticReleaseHelper.parse_commit(
|
184
|
+
commit_subject: splitted[0],
|
185
|
+
commit_body: splitted[1]
|
186
|
+
)
|
129
187
|
|
130
|
-
commit =
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
short_hash: splitted[2],
|
135
|
-
author_name: splitted[3],
|
136
|
-
commitDate: splitted[4]
|
137
|
-
}
|
188
|
+
commit[:hash] = splitted[2]
|
189
|
+
commit[:short_hash] = splitted[3]
|
190
|
+
commit[:author_name] = splitted[4]
|
191
|
+
commit[:commit_date] = splitted[5]
|
138
192
|
|
139
193
|
parsed.push(commit)
|
140
194
|
end
|
@@ -13,6 +13,49 @@ module Fastlane
|
|
13
13
|
Actions.sh(command, log: false).chomp
|
14
14
|
end
|
15
15
|
|
16
|
+
def self.parse_commit(params)
|
17
|
+
commit_subject = params[:commit_subject]
|
18
|
+
commit_body = params[:commit_body]
|
19
|
+
releases = params[:releases]
|
20
|
+
pattern = /^(docs|fix|feat|chore|style|refactor|perf|test)(\((.*)\))?(!?)\: (.*)/
|
21
|
+
merge_pattern = /^Merge/
|
22
|
+
breaking_change_pattern = /BREAKING CHANGES?: (.*)/
|
23
|
+
|
24
|
+
matched = commit_subject.match(pattern)
|
25
|
+
result = {
|
26
|
+
is_valid: false,
|
27
|
+
subject: commit_subject,
|
28
|
+
is_merge: commit_subject.match?(merge_pattern),
|
29
|
+
type: 'no_type'
|
30
|
+
}
|
31
|
+
|
32
|
+
unless matched.nil?
|
33
|
+
type = matched[1]
|
34
|
+
scope = matched[3]
|
35
|
+
|
36
|
+
result[:is_valid] = true
|
37
|
+
result[:type] = type
|
38
|
+
result[:scope] = scope
|
39
|
+
result[:has_exclamation_mark] = matched[4] == '!'
|
40
|
+
result[:subject] = matched[5]
|
41
|
+
|
42
|
+
unless releases.nil?
|
43
|
+
result[:release] = releases[type.to_sym]
|
44
|
+
end
|
45
|
+
|
46
|
+
unless commit_body.nil?
|
47
|
+
breaking_change_matched = commit_body.match(breaking_change_pattern)
|
48
|
+
|
49
|
+
unless breaking_change_matched.nil?
|
50
|
+
result[:is_breaking_change] = true
|
51
|
+
result[:breaking_change] = breaking_change_matched[1]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
result
|
57
|
+
end
|
58
|
+
|
16
59
|
def self.semver_gt(first, second)
|
17
60
|
first_major = (first.split('.')[0] || 0).to_i
|
18
61
|
first_minor = (first.split('.')[1] || 0).to_i
|
@@ -1 +1 @@
|
|
1
|
-
module Fastlane module SemanticRelease VERSION = "1.0
|
1
|
+
module Fastlane module SemanticRelease VERSION = "1.1.0" end end
|