fastlane-plugin-semantic_release 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +52 -0
- data/lib/fastlane/plugin/semantic_release.rb +16 -0
- data/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb +175 -0
- data/lib/fastlane/plugin/semantic_release/actions/conventional_changelog.rb +237 -0
- data/lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb +44 -0
- data/lib/fastlane/plugin/semantic_release/version.rb +5 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 90b987c711561a1505db17b8cdd0f3ef6082f696cd5f71231cd337e0d8266a2f
|
4
|
+
data.tar.gz: 84c398ac11d1da8a1a7e286dfe24265afd1b4d20b2b7ef2f9ff531eb856c99fd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0abb5a2d776ee404c4459b66847f9de5395fe13c0c99ab099465ed1f1c9e3867f662d380b5f29658036a4b33cbb8ccf16209eebcf0b69bb5ab5e7aec56088d53
|
7
|
+
data.tar.gz: 60fc116bba0e70db1c6a9f97582d2dbc41059c9d39bce4c6c913e710476f56e7544cb8e1e379f91eb8c60e0e8fb6c9ac85b02cd3e12b957f748639021c2c02d6
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Jiří Otáhal <xotahal@gmail.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# semantic_release plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-semantic_release)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-semantic_release`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin semantic_release
|
11
|
+
```
|
12
|
+
|
13
|
+
## About semantic_release
|
14
|
+
|
15
|
+
Automated version managment and generator of release notes.
|
16
|
+
|
17
|
+
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
|
18
|
+
|
19
|
+
## Example
|
20
|
+
|
21
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
22
|
+
|
23
|
+
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
24
|
+
|
25
|
+
## Run tests for this plugin
|
26
|
+
|
27
|
+
To run both the tests, and code style validation, run
|
28
|
+
|
29
|
+
```
|
30
|
+
rake
|
31
|
+
```
|
32
|
+
|
33
|
+
To automatically fix many of the styling issues, use
|
34
|
+
```
|
35
|
+
rubocop -a
|
36
|
+
```
|
37
|
+
|
38
|
+
## Issues and Feedback
|
39
|
+
|
40
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
41
|
+
|
42
|
+
## Troubleshooting
|
43
|
+
|
44
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
45
|
+
|
46
|
+
## Using _fastlane_ Plugins
|
47
|
+
|
48
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
49
|
+
|
50
|
+
## About _fastlane_
|
51
|
+
|
52
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/semantic_release/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module SemanticRelease
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::SemanticRelease.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/semantic_release_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
RELEASE_ANALYZED = :RELEASE_ANALYZED
|
8
|
+
RELEASE_LAST_TAG_HASH = :RELEASE_LAST_TAG_HASH
|
9
|
+
RELEASE_LAST_VERSION = :RELEASE_LAST_VERSION
|
10
|
+
RELEASE_NEXT_MAJOR_VERSION = :RELEASE_NEXT_MAJOR_VERSION
|
11
|
+
RELEASE_NEXT_MINOR_VERSION = :RELEASE_NEXT_MINOR_VERSION
|
12
|
+
RELEASE_NEXT_PATCH_VERSION = :RELEASE_NEXT_PATCH_VERSION
|
13
|
+
RELEASE_NEXT_VERSION = :RELEASE_NEXT_VERSION
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
class AnalyzeCommitsAction < Action
|
18
|
+
def self.run(params)
|
19
|
+
# Last version tag name
|
20
|
+
tag = ""
|
21
|
+
# Hash of the commit where is the last version
|
22
|
+
# If the tag is not found we are taking HEAD as reference
|
23
|
+
hash = 'HEAD'
|
24
|
+
# Default last version
|
25
|
+
version = '0.0.0'
|
26
|
+
|
27
|
+
begin
|
28
|
+
#Try to find the tag
|
29
|
+
command = "git describe --tags --match=#{params[:match]}"
|
30
|
+
tag = Actions.sh(command, log: false)
|
31
|
+
rescue
|
32
|
+
UI.message("Tag was not found for match pattern - #{params[:match]}")
|
33
|
+
end
|
34
|
+
|
35
|
+
if tag.empty? then
|
36
|
+
UI.message("First commit of the branch is taken as a begining of next release")
|
37
|
+
# If there is no tag found we taking the first commit of current branch
|
38
|
+
hash = Actions.sh('git rev-list --max-parents=0 HEAD', log: false).chomp
|
39
|
+
else
|
40
|
+
# Tag's format is v2.3.4-5-g7685948
|
41
|
+
# See git describe man page for more info
|
42
|
+
tagName = tag.split('-')[0].strip()
|
43
|
+
version = tagName.match(params[:tag_version_match])[0]
|
44
|
+
# Get a hash of last version tag
|
45
|
+
command = "git rev-list -n 1 #{tagName}"
|
46
|
+
hash = Actions.sh(command, log: false).chomp
|
47
|
+
|
48
|
+
UI.message("Found a tag #{tagName} associated with version #{version}")
|
49
|
+
end
|
50
|
+
|
51
|
+
# converts last version string to the int numbers
|
52
|
+
nextMajor = (version.split('.')[0] || 0).to_i
|
53
|
+
nextMinor = (version.split('.')[1] || 0).to_i
|
54
|
+
nextPatch = (version.split('.')[2] || 0).to_i
|
55
|
+
|
56
|
+
# Get commits log between last version and head
|
57
|
+
commits = Helper::SemanticReleaseHelper.git_log('%s', hash)
|
58
|
+
splitted = commits.split("\n");
|
59
|
+
|
60
|
+
UI.message("Found #{splitted.length} commits since last release")
|
61
|
+
releases = params[:releases]
|
62
|
+
|
63
|
+
for line in splitted
|
64
|
+
# conventional commits are in format
|
65
|
+
# type: subject (fix: app crash - for example)
|
66
|
+
type = line.split(":")[0]
|
67
|
+
release = releases[type.to_sym]
|
68
|
+
|
69
|
+
if release == "patch" then
|
70
|
+
nextPatch = nextPatch + 1
|
71
|
+
elsif release == "minor" then
|
72
|
+
nextMinor = nextMinor + 1
|
73
|
+
nextPatch = 0
|
74
|
+
elsif release == "major" then
|
75
|
+
nextMajor = nextMajor + 1
|
76
|
+
nextMinor = 0
|
77
|
+
nextPatch = 0
|
78
|
+
end
|
79
|
+
|
80
|
+
nextVersion = "#{nextMajor}.#{nextMinor}.#{nextPatch}"
|
81
|
+
UI.message("#{nextVersion}: #{line}")
|
82
|
+
end
|
83
|
+
|
84
|
+
nextVersion = "#{nextMajor}.#{nextMinor}.#{nextPatch}"
|
85
|
+
|
86
|
+
isReleaseable = Helper::SemanticReleaseHelper.semver_gt(nextVersion, version)
|
87
|
+
|
88
|
+
Actions.lane_context[SharedValues::RELEASE_ANALYZED] = true
|
89
|
+
# Last release analysis
|
90
|
+
Actions.lane_context[SharedValues::RELEASE_LAST_TAG_HASH] = hash
|
91
|
+
Actions.lane_context[SharedValues::RELEASE_LAST_VERSION] = version
|
92
|
+
# Next release analysis
|
93
|
+
Actions.lane_context[SharedValues::RELEASE_NEXT_MAJOR_VERSION] = nextMajor
|
94
|
+
Actions.lane_context[SharedValues::RELEASE_NEXT_MINOR_VERSION] = nextMinor
|
95
|
+
Actions.lane_context[SharedValues::RELEASE_NEXT_PATCH_VERSION] = nextPatch
|
96
|
+
Actions.lane_context[SharedValues::RELEASE_NEXT_VERSION] = nextVersion
|
97
|
+
|
98
|
+
if isReleaseable then
|
99
|
+
UI.success("Next version (#{nextVersion}) is higher than last version (#{version}). This version should be released.")
|
100
|
+
else
|
101
|
+
UI.test_failure!('There are no commit that would change next version since last release')
|
102
|
+
end
|
103
|
+
|
104
|
+
nextVersion
|
105
|
+
end
|
106
|
+
|
107
|
+
#####################################################
|
108
|
+
# @!group Documentation
|
109
|
+
#####################################################
|
110
|
+
|
111
|
+
def self.description
|
112
|
+
"Finds a tag of last release and determinates version of next release"
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.details
|
116
|
+
"This action will find a last release tag and analyze all commits since the tag. It uses conventional commits. Every time when commit is marked as fix or feat it will increase patch or minor number (you can setup this default behaviour). After all it will suggest if the version should be released or not."
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.available_options
|
120
|
+
# Define all options your action supports.
|
121
|
+
|
122
|
+
# Below a few examples
|
123
|
+
[
|
124
|
+
FastlaneCore::ConfigItem.new(
|
125
|
+
key: :match,
|
126
|
+
description: "Match parameter of git describe. See man page of git describe for more info",
|
127
|
+
verify_block: proc do |value|
|
128
|
+
UI.user_error!("No match for analyze_commits action given, pass using `match: 'expr'`") unless (value and not value.empty?)
|
129
|
+
end
|
130
|
+
),
|
131
|
+
FastlaneCore::ConfigItem.new(
|
132
|
+
key: :releases,
|
133
|
+
description: "Map types of commit to release (major, minor, patch)",
|
134
|
+
default_value: { fix: "patch", feat: "minor" },
|
135
|
+
type: Hash,
|
136
|
+
),
|
137
|
+
FastlaneCore::ConfigItem.new(
|
138
|
+
key: :tag_version_match,
|
139
|
+
description: "To parse version number from tag name",
|
140
|
+
default_value: '\d+\.\d+\.\d+',
|
141
|
+
),
|
142
|
+
]
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.output
|
146
|
+
# Define the shared values you are going to provide
|
147
|
+
# Example
|
148
|
+
[
|
149
|
+
['RELEASE_ANALYZED', 'True if commits were analyzed.'],
|
150
|
+
['RELEASE_LAST_TAG_HASH', 'Hash of commit that is tagged as a last version'],
|
151
|
+
['RELEASE_LAST_VERSION', 'Last version number - parsed from last tag.'],
|
152
|
+
['RELEASE_NEXT_MAJOR_VERSION', 'Major number of the next version'],
|
153
|
+
['RELEASE_NEXT_MINOR_VERSION', 'Minor number of the next version'],
|
154
|
+
['RELEASE_NEXT_PATCH_VERSION', 'Patch number of the next version'],
|
155
|
+
['RELEASE_NEXT_VERSION', 'Next version string in format (major.minor.patch)'],
|
156
|
+
]
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.return_value
|
160
|
+
# If your method provides a return value, you can describe here what it does
|
161
|
+
"Returns next version string"
|
162
|
+
end
|
163
|
+
|
164
|
+
def self.authors
|
165
|
+
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
|
166
|
+
["xotahal"]
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.is_supported?(platform)
|
170
|
+
# you can do things like
|
171
|
+
true
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/semantic_release_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
CONVENTIONAL_CHANGELOG = :CONVENTIONAL_CHANGELOG
|
8
|
+
end
|
9
|
+
|
10
|
+
class ConventionalChangelogAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
# Get next version number from shared values
|
13
|
+
analyzed = lane_context[SharedValues::RELEASE_ANALYZED]
|
14
|
+
|
15
|
+
# If analyze commits action was not run there will be no version in shared
|
16
|
+
# values. We need to run the action to get next version number
|
17
|
+
if !analyzed then
|
18
|
+
UI.user_error!("Release hasn't been analyzed yet. Run analyze_commits action first please.")
|
19
|
+
# version = other_action.analyze_commits(match: params[:match])
|
20
|
+
end
|
21
|
+
|
22
|
+
lastTagHas = lane_context[SharedValues::RELEASE_LAST_TAG_HASH]
|
23
|
+
version = lane_context[SharedValues::RELEASE_NEXT_VERSION]
|
24
|
+
|
25
|
+
# Get commits log between last version and head
|
26
|
+
commits = Helper::SemanticReleaseHelper.git_log('%s|%H|%h|%an|%at', lastTagHas)
|
27
|
+
parsed = parseCommits(commits.split("\n"))
|
28
|
+
|
29
|
+
|
30
|
+
commitUrl = params[:commit_url]
|
31
|
+
|
32
|
+
if params[:format] == 'markdown' then
|
33
|
+
result = markdown(parsed, version, commitUrl, params)
|
34
|
+
elsif params[:format] == 'slack'
|
35
|
+
result = slack(parsed, version, commitUrl, params)
|
36
|
+
end
|
37
|
+
|
38
|
+
Actions.lane_context[SharedValues::CONVENTIONAL_CHANGELOG] = result
|
39
|
+
|
40
|
+
result
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.markdown(commits, version, commitUrl, params)
|
44
|
+
sections = params[:sections]
|
45
|
+
|
46
|
+
# Begining of release notes
|
47
|
+
result = "# #{version} #{params[:title]}"
|
48
|
+
result += "\n"
|
49
|
+
result += "(#{Date.today})"
|
50
|
+
|
51
|
+
for type in params[:order]
|
52
|
+
result += "\n\n"
|
53
|
+
result += "### #{sections[type.to_sym]}"
|
54
|
+
result += "\n"
|
55
|
+
|
56
|
+
for commit in commits
|
57
|
+
if commit[:type] == type then
|
58
|
+
authorName = commit[:authorName]
|
59
|
+
shortHash = commit[:shortHash]
|
60
|
+
hash = commit[:hash]
|
61
|
+
link = "#{commitUrl}/#{hash}"
|
62
|
+
|
63
|
+
result += "- #{commit[:subject]} ([#{shortHash}](#{link}))"
|
64
|
+
|
65
|
+
if params[:display_author] then
|
66
|
+
result += "- #{authorName}"
|
67
|
+
end
|
68
|
+
|
69
|
+
result += "\n"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
result
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.slack(commits, version, commitUrl, params)
|
79
|
+
sections = params[:sections]
|
80
|
+
|
81
|
+
# Begining of release notes
|
82
|
+
result = "*#{version} #{params[:title]}* (#{Date.today})"
|
83
|
+
result += "\n"
|
84
|
+
|
85
|
+
for type in params[:order]
|
86
|
+
# write section only if there is at least one commit
|
87
|
+
next if !commits.any? { |commit| commit[:type] == type }
|
88
|
+
|
89
|
+
result += "\n\n"
|
90
|
+
result += "*#{sections[type.to_sym]}*"
|
91
|
+
result += "\n"
|
92
|
+
|
93
|
+
for commit in commits
|
94
|
+
if commit[:type] == type then
|
95
|
+
authorName = commit[:authorName]
|
96
|
+
shortHash = commit[:shortHash]
|
97
|
+
hash = commit[:hash]
|
98
|
+
link = "#{commitUrl}/#{hash}"
|
99
|
+
|
100
|
+
result += "- #{commit[:subject]} (<#{link}|#{shortHash}>)"
|
101
|
+
|
102
|
+
if params[:display_author] then
|
103
|
+
result += "- #{authorName}"
|
104
|
+
end
|
105
|
+
|
106
|
+
result += "\n"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
result
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.parseCommits(commits)
|
116
|
+
parsed = []
|
117
|
+
# %s|%H|%h|%an|%at
|
118
|
+
for line in commits
|
119
|
+
splitted = line.split("|")
|
120
|
+
|
121
|
+
subjectSplitted = splitted[0].split(":")
|
122
|
+
|
123
|
+
if subjectSplitted.length > 1 then
|
124
|
+
type = subjectSplitted[0]
|
125
|
+
subject = subjectSplitted[1]
|
126
|
+
else
|
127
|
+
type = 'no_type'
|
128
|
+
subject = subjectSplitted[0]
|
129
|
+
end
|
130
|
+
|
131
|
+
commit = {
|
132
|
+
type: type.strip(),
|
133
|
+
subject: subject.strip(),
|
134
|
+
hash: splitted[1],
|
135
|
+
shortHash: splitted[2],
|
136
|
+
authorName: splitted[3],
|
137
|
+
commitDate: splitted[4],
|
138
|
+
}
|
139
|
+
|
140
|
+
parsed.push(commit)
|
141
|
+
end
|
142
|
+
|
143
|
+
parsed
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
#####################################################
|
148
|
+
# @!group Documentation
|
149
|
+
#####################################################
|
150
|
+
|
151
|
+
def self.description
|
152
|
+
"Get commits since last version and generates release notes"
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.details
|
156
|
+
"Uses conventional commits. It groups commits by their types and generates release notes in markdown or slack format."
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.available_options
|
160
|
+
# Define all options your action supports.
|
161
|
+
|
162
|
+
# Below a few examples
|
163
|
+
[
|
164
|
+
FastlaneCore::ConfigItem.new(
|
165
|
+
key: :format,
|
166
|
+
description: "You can use either markdown or slack",
|
167
|
+
default_value: "markdown",
|
168
|
+
optional: true
|
169
|
+
),
|
170
|
+
FastlaneCore::ConfigItem.new(
|
171
|
+
key: :title,
|
172
|
+
description: "Title of release notes",
|
173
|
+
optional: true
|
174
|
+
),
|
175
|
+
FastlaneCore::ConfigItem.new(
|
176
|
+
key: :commit_url,
|
177
|
+
description: "Uses as a link to the commit",
|
178
|
+
optional: true
|
179
|
+
),
|
180
|
+
FastlaneCore::ConfigItem.new(
|
181
|
+
key: :order,
|
182
|
+
description: "You can change order of groups in release notes",
|
183
|
+
default_value: ["feat", "fix", "refactor", "perf", "chore", "test", "docs", "no_type"],
|
184
|
+
type: Array,
|
185
|
+
optional: true
|
186
|
+
),
|
187
|
+
FastlaneCore::ConfigItem.new(
|
188
|
+
key: :sections,
|
189
|
+
description: "Map type to section title",
|
190
|
+
default_value: {
|
191
|
+
feat: "Features",
|
192
|
+
fix: "Bug fixes",
|
193
|
+
refactor: "Code refactoring",
|
194
|
+
perf: "Performance improving",
|
195
|
+
chore: "Building system",
|
196
|
+
test: "Testing",
|
197
|
+
docs: "Documentation",
|
198
|
+
no_type: "Rest work",
|
199
|
+
},
|
200
|
+
type: Hash,
|
201
|
+
optional: true
|
202
|
+
),
|
203
|
+
FastlaneCore::ConfigItem.new(
|
204
|
+
key: :display_author,
|
205
|
+
description: "Wheter or not you want to display author of commit",
|
206
|
+
default_value: false,
|
207
|
+
type: Boolean,
|
208
|
+
optional: true
|
209
|
+
),
|
210
|
+
]
|
211
|
+
end
|
212
|
+
|
213
|
+
def self.output
|
214
|
+
# Define the shared values you are going to provide
|
215
|
+
# Example
|
216
|
+
[
|
217
|
+
['CONVENTIONAL_CHANGELOG', 'Generated conventional changelog']
|
218
|
+
]
|
219
|
+
end
|
220
|
+
|
221
|
+
def self.return_value
|
222
|
+
# If your method provides a return value, you can describe here what it does
|
223
|
+
"Returns generated release notes as a string"
|
224
|
+
end
|
225
|
+
|
226
|
+
def self.authors
|
227
|
+
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
|
228
|
+
["xotahal"]
|
229
|
+
end
|
230
|
+
|
231
|
+
def self.is_supported?(platform)
|
232
|
+
# you can do things like
|
233
|
+
true
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class SemanticReleaseHelper
|
8
|
+
# class methods that you define here become available in your action
|
9
|
+
# as `Helper::SemanticReleaseHelper.your_method`
|
10
|
+
#
|
11
|
+
def self.git_log(pretty, start)
|
12
|
+
command = "git log --pretty='#{pretty}' --reverse #{start}..HEAD"
|
13
|
+
Actions.sh(command, log: false).chomp
|
14
|
+
end
|
15
|
+
def self.semver_gt(first, second)
|
16
|
+
firstMajor = (first.split('.')[0] || 0).to_i
|
17
|
+
firstMinor = (first.split('.')[1] || 0).to_i
|
18
|
+
firstPatch = (first.split('.')[2] || 0).to_i
|
19
|
+
|
20
|
+
secondMajor = (second.split('.')[0] || 0).to_i
|
21
|
+
secondMinor = (second.split('.')[1] || 0).to_i
|
22
|
+
secondPatch = (second.split('.')[2] || 0).to_i
|
23
|
+
|
24
|
+
# Check if next version is higher then last version
|
25
|
+
if firstMajor > secondMajor then
|
26
|
+
return true
|
27
|
+
elsif firstMajor == secondMajor then
|
28
|
+
if firstMinor > secondMinor then
|
29
|
+
return true
|
30
|
+
elsif firstMinor == secondMinor then
|
31
|
+
if firstPatch > secondPatch then
|
32
|
+
return true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
def self.semver_lt(first, second)
|
40
|
+
return !semver_gt(first,second)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-semantic_release
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jiří Otáhal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-require_tools
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fastlane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.117.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.117.1
|
139
|
+
description:
|
140
|
+
email: xotahal@gmail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- lib/fastlane/plugin/semantic_release.rb
|
148
|
+
- lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb
|
149
|
+
- lib/fastlane/plugin/semantic_release/actions/conventional_changelog.rb
|
150
|
+
- lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb
|
151
|
+
- lib/fastlane/plugin/semantic_release/version.rb
|
152
|
+
homepage: https://github.com/xotahal/fastlane-plugin-semantic_release
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 2.7.6
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: Automated version managment and generator of release notes.
|
176
|
+
test_files: []
|