fastlane-plugin-semantic_release 1.6.0 → 1.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbed5774e51b22bae867d1c7ec9ab0d339bacda427e3e38683c8e6d4735e2f71
4
- data.tar.gz: 21c6e183c51efc18c15391ed8e2c684341b3e6b97b08ba3d473d2966814999a3
3
+ metadata.gz: c5e12ea9120ab4bccc7f4206d24511fd0455d86cd38cd4b4eb3f6713a8a37a84
4
+ data.tar.gz: bdda044be599d10eb6843bbb197dbd3ab338a109bc72ff86ad0c221899c0a517
5
5
  SHA512:
6
- metadata.gz: 57e0b26f796db7f5b0567f99e3929a68602464dfed9f904cbcd89bab960f0403513a6492131cbc5e14eaf4bf6a08c256befb99c64e5c5f687b776bfe08153ac6
7
- data.tar.gz: 01e505d0233953038d47b7a7a64b5ff62493e06c0e68236dfb9e66b4dbe149843a18f9cb442d63d74402321d7d2d002e7a49ff418a17255b932ba5b07d50c8c5
6
+ metadata.gz: e3b583d81b5ba72b45a7698265667a698a7e3fc7c3070f1e39bcfc79393d38dc4436525d7482967a4a0d2995df5f652a4d5621866710dce91ef145179bd02669
7
+ data.tar.gz: 0c641c08118d7a8796fec1a5bf703e28f0dc3250870f374142e6cba442df88295c30d27615372eedded46c277ad613045a49214e1bd605a07b6d537dd7fc8740
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: false)
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: false).chomp
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('%s|%b|>', params[:hash])
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(match: params[:match])
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: false).chomp
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(tag_name: tag_name)
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,7 +81,10 @@ 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(hash: 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]
@@ -85,6 +98,14 @@ module Fastlane
85
98
  releases: releases
86
99
  )
87
100
 
101
+ unless commit[:scope].nil?
102
+ # 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
103
+ scope = commit[:scope]
104
+ scopes_to_ignore = params[:ignore_scopes]
105
+ # if it is, we'll skip this commit when bumping versions
106
+ next if scopes_to_ignore.include?(scope) #=> true
107
+ end
108
+
88
109
  if commit[:release] == "major" || commit[:is_breaking_change]
89
110
  next_major += 1
90
111
  next_minor = 0
@@ -122,16 +143,29 @@ module Fastlane
122
143
  end
123
144
 
124
145
  def self.is_codepush_friendly(params)
146
+ git_command = 'git rev-list --max-parents=0 HEAD'
125
147
  # Begining of the branch is taken for codepush analysis
126
- hash = Actions.sh('git rev-list --max-parents=0 HEAD', log: false).chomp
148
+ hash_lines = Actions.sh("#{git_command} | wc -l", log: params[:debug]).chomp
149
+ hash = Actions.sh(git_command, log: params[:debug]).chomp
127
150
  next_major = 0
128
151
  next_minor = 0
129
152
  next_patch = 0
130
153
  last_incompatible_codepush_version = '0.0.0'
131
154
 
155
+ if hash_lines.to_i > 1
156
+ UI.error("#{git_command} resulted to more than 1 hash")
157
+ 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.')
158
+ Actions.sh(git_command, log: true).chomp
159
+ return false
160
+ end
161
+
132
162
  # Get commits log between last version and head
133
- splitted = get_commits_from_hash(hash: hash)
163
+ splitted = get_commits_from_hash(
164
+ hash: hash,
165
+ debug: params[:debug]
166
+ )
134
167
  releases = params[:releases]
168
+ codepush_friendly = params[:codepush_friendly]
135
169
 
136
170
  splitted.each do |line|
137
171
  # conventional commits are in format
@@ -139,7 +173,8 @@ module Fastlane
139
173
  commit = Helper::SemanticReleaseHelper.parse_commit(
140
174
  commit_subject: line.split("|")[0],
141
175
  commit_body: line.split("|")[1],
142
- releases: releases
176
+ releases: releases,
177
+ codepush_friendly: codepush_friendly
143
178
  )
144
179
 
145
180
  if commit[:release] == "major" || commit[:is_breaking_change]
@@ -198,10 +233,31 @@ module Fastlane
198
233
  default_value: { fix: "patch", feat: "minor" },
199
234
  type: Hash
200
235
  ),
236
+ FastlaneCore::ConfigItem.new(
237
+ key: :codepush_friendly,
238
+ description: "These types are consider as codepush friendly automatically",
239
+ default_value: ["chore", "test", "docs"],
240
+ type: Array,
241
+ optional: true
242
+ ),
201
243
  FastlaneCore::ConfigItem.new(
202
244
  key: :tag_version_match,
203
245
  description: "To parse version number from tag name",
204
246
  default_value: '\d+\.\d+\.\d+'
247
+ ),
248
+ FastlaneCore::ConfigItem.new(
249
+ key: :ignore_scopes,
250
+ description: "To ignore certain scopes when calculating releases",
251
+ default_value: [],
252
+ type: Array,
253
+ optional: true
254
+ ),
255
+ FastlaneCore::ConfigItem.new(
256
+ key: :debug,
257
+ description: "True if you want to log out a debug info",
258
+ default_value: false,
259
+ type: Boolean,
260
+ optional: true
205
261
  )
206
262
  ]
207
263
  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('%s|%b|%H|%h|%an|%at|>', params[:hash])
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(hash: last_tag_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,15 +8,16 @@ 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(pretty, start)
12
- command = "git log --pretty='#{pretty}' --reverse #{start}..HEAD"
13
- Actions.sh(command, log: false).chomp
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)
17
17
  commit_subject = params[:commit_subject].strip
18
18
  commit_body = params[:commit_body]
19
19
  releases = params[:releases]
20
+ codepush_friendly = params[:codepush_friendly]
20
21
  pattern = /^(docs|fix|feat|chore|style|refactor|perf|test)(\((.*)\))?(!?)\: (.*)/
21
22
  breaking_change_pattern = /BREAKING CHANGES?: (.*)/
22
23
  codepush_pattern = /codepush?: (.*)/
@@ -42,6 +43,9 @@ module Fastlane
42
43
  unless releases.nil?
43
44
  result[:release] = releases[type.to_sym]
44
45
  end
46
+ unless codepush_friendly.nil?
47
+ result[:is_codepush_friendly] = codepush_friendly.include?(type)
48
+ end
45
49
 
46
50
  unless commit_body.nil?
47
51
  breaking_change_matched = commit_body.match(breaking_change_pattern)
@@ -52,7 +56,7 @@ module Fastlane
52
56
  result[:breaking_change] = breaking_change_matched[1]
53
57
  end
54
58
  unless codepush_matched.nil?
55
- result[:is_codepush_friendly] = true
59
+ result[:is_codepush_friendly] = codepush_matched[1] == 'ok'
56
60
  end
57
61
  end
58
62
  end
@@ -1 +1 @@
1
- module Fastlane module SemanticRelease VERSION = "1.6.0" end end
1
+ module Fastlane module SemanticRelease VERSION = "1.9.2" 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.6.0
4
+ version: 1.9.2
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: 2019-11-22 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry