fastlane-plugin-semantic_release 1.7.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb +69 -13
- data/lib/fastlane/plugin/semantic_release/actions/conventional_changelog.rb +16 -2
- data/lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb +3 -3
- 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: '09b6df2db881fa64fd8f22d9998294264f297c115c167d567600c2e0a533a542'
|
4
|
+
data.tar.gz: 8a58251af5f6e006ac4a6e59628712c7ecb3bc893ad1634d43fd92826690c36a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 908a132fc7bfab4c454aac9fae3f32ae55baf1733f1939505ba5e68570ed9e6c60b598095bbdd990b26e20dfb8272a790f1eacfce9fd266b354ad98ab0fa1663
|
7
|
+
data.tar.gz: 615daa5dd8fe4814cb0d423bf0e8fc4a6a12e4b5eeeb2f25bd7c77278c5aaf28284d9c507778a71d9550385abdb0b6ce7985dd5adb1694c3252391dc89050055
|
data/README.md
CHANGED
@@ -50,6 +50,12 @@ notes = conventional_changelog(format: 'slack', title: 'Android Alpha')
|
|
50
50
|
- analyzes subject of every single commit and increases version number if there is a need (check conventional commit rules)
|
51
51
|
- if next version number is higher then last version number it will recommend you to release this version
|
52
52
|
|
53
|
+
Options:
|
54
|
+
|
55
|
+
- `ignore_scopes: ['android','windows']`: allows you to ignore any commits which include a given scope, like this one: `feat(android): add functionality not relevant to the release we are producing`
|
56
|
+
|
57
|
+
Example usage:
|
58
|
+
|
53
59
|
```
|
54
60
|
isReleasable = analyze_commits(match: 'ios/beta*')
|
55
61
|
```
|
@@ -19,7 +19,7 @@ module Fastlane
|
|
19
19
|
def self.get_last_tag(params)
|
20
20
|
# Try to find the tag
|
21
21
|
command = "git describe --tags --match=#{params[:match]}"
|
22
|
-
Actions.sh(command, log:
|
22
|
+
Actions.sh(command, log: params[:debug])
|
23
23
|
rescue
|
24
24
|
UI.message("Tag was not found for match pattern - #{params[:match]}")
|
25
25
|
''
|
@@ -27,11 +27,15 @@ module Fastlane
|
|
27
27
|
|
28
28
|
def self.get_last_tag_hash(params)
|
29
29
|
command = "git rev-list -n 1 refs/tags/#{params[:tag_name]}"
|
30
|
-
Actions.sh(command, log:
|
30
|
+
Actions.sh(command, log: params[:debug]).chomp
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.get_commits_from_hash(params)
|
34
|
-
commits = Helper::SemanticReleaseHelper.git_log(
|
34
|
+
commits = Helper::SemanticReleaseHelper.git_log(
|
35
|
+
pretty: '%s|%b|>',
|
36
|
+
start: params[:hash],
|
37
|
+
debug: params[:debug]
|
38
|
+
)
|
35
39
|
commits.split("|>")
|
36
40
|
end
|
37
41
|
|
@@ -42,16 +46,19 @@ module Fastlane
|
|
42
46
|
# Default last version
|
43
47
|
version = '0.0.0'
|
44
48
|
|
45
|
-
tag = get_last_tag(
|
49
|
+
tag = get_last_tag(
|
50
|
+
match: params[:match],
|
51
|
+
debug: params[:debug]
|
52
|
+
)
|
46
53
|
|
47
54
|
if tag.empty?
|
48
55
|
UI.message("First commit of the branch is taken as a begining of next release")
|
49
56
|
# If there is no tag found we taking the first commit of current branch
|
50
|
-
hash = Actions.sh('git rev-list --max-parents=0 HEAD', log:
|
57
|
+
hash = Actions.sh('git rev-list --max-parents=0 HEAD', log: params[:debug]).chomp
|
51
58
|
else
|
52
59
|
# Tag's format is v2.3.4-5-g7685948
|
53
60
|
# See git describe man page for more info
|
54
|
-
tag_name = tag.split('-')[0].strip
|
61
|
+
tag_name = tag.split('-')[0...-2].join('-').strip
|
55
62
|
parsed_version = tag_name.match(params[:tag_version_match])
|
56
63
|
|
57
64
|
if parsed_version.nil?
|
@@ -60,7 +67,10 @@ module Fastlane
|
|
60
67
|
|
61
68
|
version = parsed_version[0]
|
62
69
|
# Get a hash of last version tag
|
63
|
-
hash = get_last_tag_hash(
|
70
|
+
hash = get_last_tag_hash(
|
71
|
+
tag_name: tag_name,
|
72
|
+
debug: params[:debug]
|
73
|
+
)
|
64
74
|
|
65
75
|
UI.message("Found a tag #{tag_name} associated with version #{version}")
|
66
76
|
end
|
@@ -71,20 +81,33 @@ module Fastlane
|
|
71
81
|
next_patch = (version.split('.')[2] || 0).to_i
|
72
82
|
|
73
83
|
# Get commits log between last version and head
|
74
|
-
splitted = get_commits_from_hash(
|
84
|
+
splitted = get_commits_from_hash(
|
85
|
+
hash: hash,
|
86
|
+
debug: params[:debug]
|
87
|
+
)
|
75
88
|
|
76
89
|
UI.message("Found #{splitted.length} commits since last release")
|
77
90
|
releases = params[:releases]
|
78
91
|
|
79
92
|
splitted.each do |line|
|
93
|
+
parts = line.split("|")
|
94
|
+
subject = parts[0].strip
|
80
95
|
# conventional commits are in format
|
81
96
|
# type: subject (fix: app crash - for example)
|
82
97
|
commit = Helper::SemanticReleaseHelper.parse_commit(
|
83
|
-
commit_subject:
|
84
|
-
commit_body:
|
98
|
+
commit_subject: subject,
|
99
|
+
commit_body: parts[1],
|
85
100
|
releases: releases
|
86
101
|
)
|
87
102
|
|
103
|
+
unless commit[:scope].nil?
|
104
|
+
# 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
|
105
|
+
scope = commit[:scope]
|
106
|
+
scopes_to_ignore = params[:ignore_scopes]
|
107
|
+
# if it is, we'll skip this commit when bumping versions
|
108
|
+
next if scopes_to_ignore.include?(scope) #=> true
|
109
|
+
end
|
110
|
+
|
88
111
|
if commit[:release] == "major" || commit[:is_breaking_change]
|
89
112
|
next_major += 1
|
90
113
|
next_minor = 0
|
@@ -97,7 +120,7 @@ module Fastlane
|
|
97
120
|
end
|
98
121
|
|
99
122
|
next_version = "#{next_major}.#{next_minor}.#{next_patch}"
|
100
|
-
UI.message("#{next_version}: #{
|
123
|
+
UI.message("#{next_version}: #{subject}") if params[:show_version_path]
|
101
124
|
end
|
102
125
|
|
103
126
|
next_version = "#{next_major}.#{next_minor}.#{next_patch}"
|
@@ -122,15 +145,27 @@ module Fastlane
|
|
122
145
|
end
|
123
146
|
|
124
147
|
def self.is_codepush_friendly(params)
|
148
|
+
git_command = 'git rev-list --max-parents=0 HEAD'
|
125
149
|
# Begining of the branch is taken for codepush analysis
|
126
|
-
|
150
|
+
hash_lines = Actions.sh("#{git_command} | wc -l", log: params[:debug]).chomp
|
151
|
+
hash = Actions.sh(git_command, log: params[:debug]).chomp
|
127
152
|
next_major = 0
|
128
153
|
next_minor = 0
|
129
154
|
next_patch = 0
|
130
155
|
last_incompatible_codepush_version = '0.0.0'
|
131
156
|
|
157
|
+
if hash_lines.to_i > 1
|
158
|
+
UI.error("#{git_command} resulted to more than 1 hash")
|
159
|
+
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.')
|
160
|
+
Actions.sh(git_command, log: true).chomp
|
161
|
+
return false
|
162
|
+
end
|
163
|
+
|
132
164
|
# Get commits log between last version and head
|
133
|
-
splitted = get_commits_from_hash(
|
165
|
+
splitted = get_commits_from_hash(
|
166
|
+
hash: hash,
|
167
|
+
debug: params[:debug]
|
168
|
+
)
|
134
169
|
releases = params[:releases]
|
135
170
|
codepush_friendly = params[:codepush_friendly]
|
136
171
|
|
@@ -211,6 +246,27 @@ module Fastlane
|
|
211
246
|
key: :tag_version_match,
|
212
247
|
description: "To parse version number from tag name",
|
213
248
|
default_value: '\d+\.\d+\.\d+'
|
249
|
+
),
|
250
|
+
FastlaneCore::ConfigItem.new(
|
251
|
+
key: :ignore_scopes,
|
252
|
+
description: "To ignore certain scopes when calculating releases",
|
253
|
+
default_value: [],
|
254
|
+
type: Array,
|
255
|
+
optional: true
|
256
|
+
),
|
257
|
+
FastlaneCore::ConfigItem.new(
|
258
|
+
key: :show_version_path,
|
259
|
+
description: "True if you want to print out the version calculated for each commit",
|
260
|
+
default_value: true,
|
261
|
+
type: Boolean,
|
262
|
+
optional: true
|
263
|
+
),
|
264
|
+
FastlaneCore::ConfigItem.new(
|
265
|
+
key: :debug,
|
266
|
+
description: "True if you want to log out a debug info",
|
267
|
+
default_value: false,
|
268
|
+
type: Boolean,
|
269
|
+
optional: true
|
214
270
|
)
|
215
271
|
]
|
216
272
|
end
|
@@ -8,7 +8,11 @@ module Fastlane
|
|
8
8
|
|
9
9
|
class ConventionalChangelogAction < Action
|
10
10
|
def self.get_commits_from_hash(params)
|
11
|
-
commits = Helper::SemanticReleaseHelper.git_log(
|
11
|
+
commits = Helper::SemanticReleaseHelper.git_log(
|
12
|
+
pretty: '%s|%b|%H|%h|%an|%at|>',
|
13
|
+
start: params[:hash],
|
14
|
+
debug: params[:debug]
|
15
|
+
)
|
12
16
|
commits.split("|>")
|
13
17
|
end
|
14
18
|
|
@@ -27,7 +31,10 @@ module Fastlane
|
|
27
31
|
version = lane_context[SharedValues::RELEASE_NEXT_VERSION]
|
28
32
|
|
29
33
|
# Get commits log between last version and head
|
30
|
-
commits = get_commits_from_hash(
|
34
|
+
commits = get_commits_from_hash(
|
35
|
+
hash: last_tag_hash,
|
36
|
+
debug: params[:debug]
|
37
|
+
)
|
31
38
|
parsed = parse_commits(commits)
|
32
39
|
|
33
40
|
commit_url = params[:commit_url]
|
@@ -263,6 +270,13 @@ module Fastlane
|
|
263
270
|
default_value: true,
|
264
271
|
type: Boolean,
|
265
272
|
optional: true
|
273
|
+
),
|
274
|
+
FastlaneCore::ConfigItem.new(
|
275
|
+
key: :debug,
|
276
|
+
description: "True if you want to log out a debug info",
|
277
|
+
default_value: false,
|
278
|
+
type: Boolean,
|
279
|
+
optional: true
|
266
280
|
)
|
267
281
|
]
|
268
282
|
end
|
@@ -8,9 +8,9 @@ module Fastlane
|
|
8
8
|
# class methods that you define here become available in your action
|
9
9
|
# as `Helper::SemanticReleaseHelper.your_method`
|
10
10
|
#
|
11
|
-
def self.git_log(
|
12
|
-
command = "git log --pretty='#{pretty}' --reverse #{start}..HEAD"
|
13
|
-
Actions.sh(command, log:
|
11
|
+
def self.git_log(params)
|
12
|
+
command = "git log --pretty='#{params[:pretty]}' --reverse #{params[:start]}..HEAD"
|
13
|
+
Actions.sh(command, log: params[:debug]).chomp
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.parse_commit(params)
|
@@ -1 +1 @@
|
|
1
|
-
module Fastlane module SemanticRelease VERSION = "1.
|
1
|
+
module Fastlane module SemanticRelease VERSION = "1.11.0" 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.11.0
|
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: 2020-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|