fastlane-plugin-semantic_release 1.5.1 → 1.6.0

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: 9a1dd33a05c2a6864d2a60b13cb2fc1b6bae08e1549075bc5355b67c4e023e4c
4
- data.tar.gz: a8c22242d8d8304f211da2ef3229505926763468856a223d9543cd545b6e3cdf
3
+ metadata.gz: dbed5774e51b22bae867d1c7ec9ab0d339bacda427e3e38683c8e6d4735e2f71
4
+ data.tar.gz: 21c6e183c51efc18c15391ed8e2c684341b3e6b97b08ba3d473d2966814999a3
5
5
  SHA512:
6
- metadata.gz: '0009044f8a040373ea1bf0601a8a3b38ad5e6269b0c78daded0c2b2a78eada4667e906e37d47f7f54711615c620fd7c16ccce4b3e8db50b27a440bc0163ac60f'
7
- data.tar.gz: 342c0423b25bfe6ff9e0aa4dd3ae7a7fedbfc5bcd7c23aa16faacd5abcb045e8cd8b75a3ba8e2dd92c14c0508aad559a6fdd8d280cb84525c211f7e171a3b0e1
6
+ metadata.gz: 57e0b26f796db7f5b0567f99e3929a68602464dfed9f904cbcd89bab960f0403513a6492131cbc5e14eaf4bf6a08c256befb99c64e5c5f687b776bfe08153ac6
7
+ data.tar.gz: 01e505d0233953038d47b7a7a64b5ff62493e06c0e68236dfb9e66b4dbe149843a18f9cb442d63d74402321d7d2d002e7a49ff418a17255b932ba5b07d50c8c5
@@ -12,6 +12,7 @@ module Fastlane
12
12
  RELEASE_NEXT_MINOR_VERSION = :RELEASE_NEXT_MINOR_VERSION
13
13
  RELEASE_NEXT_PATCH_VERSION = :RELEASE_NEXT_PATCH_VERSION
14
14
  RELEASE_NEXT_VERSION = :RELEASE_NEXT_VERSION
15
+ RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION = :RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION
15
16
  end
16
17
 
17
18
  class AnalyzeCommitsAction < Action
@@ -34,7 +35,7 @@ module Fastlane
34
35
  commits.split("|>")
35
36
  end
36
37
 
37
- def self.run(params)
38
+ def self.is_releasable(params)
38
39
  # Hash of the commit where is the last version
39
40
  # If the tag is not found we are taking HEAD as reference
40
41
  hash = 'HEAD'
@@ -101,10 +102,10 @@ module Fastlane
101
102
 
102
103
  next_version = "#{next_major}.#{next_minor}.#{next_patch}"
103
104
 
104
- is_releasable = Helper::SemanticReleaseHelper.semver_gt(next_version, version)
105
+ is_next_version_releasable = Helper::SemanticReleaseHelper.semver_gt(next_version, version)
105
106
 
106
107
  Actions.lane_context[SharedValues::RELEASE_ANALYZED] = true
107
- Actions.lane_context[SharedValues::RELEASE_IS_NEXT_VERSION_HIGHER] = is_releasable
108
+ Actions.lane_context[SharedValues::RELEASE_IS_NEXT_VERSION_HIGHER] = is_next_version_releasable
108
109
  # Last release analysis
109
110
  Actions.lane_context[SharedValues::RELEASE_LAST_TAG_HASH] = hash
110
111
  Actions.lane_context[SharedValues::RELEASE_LAST_VERSION] = version
@@ -115,9 +116,56 @@ module Fastlane
115
116
  Actions.lane_context[SharedValues::RELEASE_NEXT_VERSION] = next_version
116
117
 
117
118
  success_message = "Next version (#{next_version}) is higher than last version (#{version}). This version should be released."
118
- UI.success(success_message) if is_releasable
119
+ UI.success(success_message) if is_next_version_releasable
120
+
121
+ is_next_version_releasable
122
+ end
123
+
124
+ def self.is_codepush_friendly(params)
125
+ # Begining of the branch is taken for codepush analysis
126
+ hash = Actions.sh('git rev-list --max-parents=0 HEAD', log: false).chomp
127
+ next_major = 0
128
+ next_minor = 0
129
+ next_patch = 0
130
+ last_incompatible_codepush_version = '0.0.0'
131
+
132
+ # Get commits log between last version and head
133
+ splitted = get_commits_from_hash(hash: hash)
134
+ releases = params[:releases]
135
+
136
+ splitted.each do |line|
137
+ # conventional commits are in format
138
+ # type: subject (fix: app crash - for example)
139
+ commit = Helper::SemanticReleaseHelper.parse_commit(
140
+ commit_subject: line.split("|")[0],
141
+ commit_body: line.split("|")[1],
142
+ releases: releases
143
+ )
144
+
145
+ if commit[:release] == "major" || commit[:is_breaking_change]
146
+ next_major += 1
147
+ next_minor = 0
148
+ next_patch = 0
149
+ elsif commit[:release] == "minor"
150
+ next_minor += 1
151
+ next_patch = 0
152
+ elsif commit[:release] == "patch"
153
+ next_patch += 1
154
+ end
155
+
156
+ unless commit[:is_codepush_friendly]
157
+ last_incompatible_codepush_version = "#{next_major}.#{next_minor}.#{next_patch}"
158
+ end
159
+ end
160
+
161
+ Actions.lane_context[SharedValues::RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION] = last_incompatible_codepush_version
162
+ end
163
+
164
+ def self.run(params)
165
+ is_next_version_releasable = is_releasable(params)
166
+ is_codepush_friendly(params)
119
167
 
120
- is_releasable
168
+ is_next_version_releasable
121
169
  end
122
170
 
123
171
  #####################################################
@@ -169,7 +217,8 @@ module Fastlane
169
217
  ['RELEASE_NEXT_MAJOR_VERSION', 'Major number of the next version'],
170
218
  ['RELEASE_NEXT_MINOR_VERSION', 'Minor number of the next version'],
171
219
  ['RELEASE_NEXT_PATCH_VERSION', 'Patch number of the next version'],
172
- ['RELEASE_NEXT_VERSION', 'Next version string in format (major.minor.patch)']
220
+ ['RELEASE_NEXT_VERSION', 'Next version string in format (major.minor.patch)'],
221
+ ['RELEASE_LAST_INCOMPATIBLE_CODEPUSH_VERSION', 'Last commit without codepush']
173
222
  ]
174
223
  end
175
224
 
@@ -19,6 +19,7 @@ module Fastlane
19
19
  releases = params[:releases]
20
20
  pattern = /^(docs|fix|feat|chore|style|refactor|perf|test)(\((.*)\))?(!?)\: (.*)/
21
21
  breaking_change_pattern = /BREAKING CHANGES?: (.*)/
22
+ codepush_pattern = /codepush?: (.*)/
22
23
 
23
24
  matched = commit_subject.match(pattern)
24
25
  result = {
@@ -44,11 +45,15 @@ module Fastlane
44
45
 
45
46
  unless commit_body.nil?
46
47
  breaking_change_matched = commit_body.match(breaking_change_pattern)
48
+ codepush_matched = commit_body.match(codepush_pattern)
47
49
 
48
50
  unless breaking_change_matched.nil?
49
51
  result[:is_breaking_change] = true
50
52
  result[:breaking_change] = breaking_change_matched[1]
51
53
  end
54
+ unless codepush_matched.nil?
55
+ result[:is_codepush_friendly] = true
56
+ end
52
57
  end
53
58
  end
54
59
 
@@ -1 +1 @@
1
- module Fastlane module SemanticRelease VERSION = "1.5.1" end end
1
+ module Fastlane module SemanticRelease VERSION = "1.6.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.5.1
4
+ version: 1.6.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: 2019-11-11 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry