fastlane-plugin-semantic_versioning 1.0.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +74 -0
- data/lib/fastlane/plugin/semantic_versioning/actions/get_versioning_info_action.rb +127 -0
- data/lib/fastlane/plugin/semantic_versioning/actions/semantic_bump_action.rb +86 -0
- data/lib/fastlane/plugin/semantic_versioning/helper/semantic_versioning_helper.rb +168 -0
- data/lib/fastlane/plugin/semantic_versioning/version.rb +5 -0
- data/lib/fastlane/plugin/semantic_versioning.rb +16 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 85cd9cae201bc1df61f042591928d143e3be6b16f2118af031d8277872bb2602
|
4
|
+
data.tar.gz: a1bc72d14b4866bf874ff0f1ad0b47e965baa895bcfed5ded778120e17a66ec8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 51ea808a889665240814d26ce939f1c006c9bd03b6544a3a289e38afb460668dc51e4f723a4507b6a8f3a3112b71bb1bd407bfd2da5df513a22b085b3053337e
|
7
|
+
data.tar.gz: 0227ac5c1726f2e9954f9d272bb36e99fbf83af5280e7831ffb823ccd44ed32f1b5528c57188a4bd927956e9cdcbd7940183604369fcbcf6c95e830c1e9cd85c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Karsten Silkenbäumer <993392+kassi@users.noreply.github.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,74 @@
|
|
1
|
+
# semantic_versioning plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-semantic_versioning)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-semantic_versioning`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin semantic_versioning
|
11
|
+
```
|
12
|
+
|
13
|
+
## About semantic_versioning
|
14
|
+
|
15
|
+
Version and changelog management following semantic versioning and conventional commits.
|
16
|
+
|
17
|
+
The plugin provides two actions that have to be called in sequence, but therefore allow
|
18
|
+
additional interaction with the results before an actual commit is being made.
|
19
|
+
|
20
|
+
One example could be to get the version info for the upcoming release, and when this is
|
21
|
+
successful, i.e. a version bump is possible, create a release branch with that version number and
|
22
|
+
change to that branch before making any changes. Then call the `semantic_bump` action to create the commit on the release branch, before you may want to create a pull request for the new release.
|
23
|
+
|
24
|
+
Hint: You can also use the context to upload the changelog to AppStoreConnect afterwards. See the example `Fastfile` for more info.
|
25
|
+
|
26
|
+
### get_versioning_info
|
27
|
+
|
28
|
+
Call this in your lane to prepare a bump according to the rules. It will
|
29
|
+
- Determine next version number
|
30
|
+
- Build the changelog for the upcoming version bump
|
31
|
+
|
32
|
+
and provide this information in shared variables that are used in the second action.
|
33
|
+
|
34
|
+
### semantic_bump
|
35
|
+
|
36
|
+
Call this to actually bump the version, write the changelog and commit everything.
|
37
|
+
|
38
|
+
## Example
|
39
|
+
|
40
|
+
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`.
|
41
|
+
|
42
|
+
## Run tests for this plugin
|
43
|
+
|
44
|
+
To run both the tests, and code style validation, run
|
45
|
+
|
46
|
+
```
|
47
|
+
bundle exec rake
|
48
|
+
```
|
49
|
+
|
50
|
+
To automatically fix many of the styling issues, use
|
51
|
+
```
|
52
|
+
bundle exec rubocop -a
|
53
|
+
```
|
54
|
+
|
55
|
+
Or to start fast feedback development cycle:
|
56
|
+
```
|
57
|
+
bundle exec guard
|
58
|
+
```
|
59
|
+
|
60
|
+
## Issues and Feedback
|
61
|
+
|
62
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
63
|
+
|
64
|
+
## Troubleshooting
|
65
|
+
|
66
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
67
|
+
|
68
|
+
## Using _fastlane_ Plugins
|
69
|
+
|
70
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
71
|
+
|
72
|
+
## About _fastlane_
|
73
|
+
|
74
|
+
_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,127 @@
|
|
1
|
+
require "fastlane/action"
|
2
|
+
require "fastlane_core/configuration/config_item"
|
3
|
+
require_relative "../helper/semantic_versioning_helper"
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
module SharedValues
|
8
|
+
SEMVER_CURRENT_VERSION = :SEMVER_CURRENT_VERSION
|
9
|
+
SEMVER_CURRENT_TAG = :SEMVER_CURRENT_TAG
|
10
|
+
SEMVER_BUMP_TYPE = :SEMVER_BUMP_TYPE
|
11
|
+
SEMVER_NEW_VERSION = :SEMVER_NEW_VERSION
|
12
|
+
SEMVER_NEW_CHANGELOG = :SEMVER_NEW_CHANGELOG
|
13
|
+
SEMVER_BUMPABLE = :SEMVER_BUMPABLE
|
14
|
+
end
|
15
|
+
|
16
|
+
class GetVersioningInfoAction < Action
|
17
|
+
def self.run(params)
|
18
|
+
params[:allowed_types].map!(&:to_sym)
|
19
|
+
params[:bump_map].transform_keys!(&:to_sym)
|
20
|
+
params[:bump_map].transform_values!(&:to_sym)
|
21
|
+
|
22
|
+
UI.message("The semantic_versioning plugin is working!")
|
23
|
+
|
24
|
+
current_version = Helper::SemanticVersioningHelper.version_number
|
25
|
+
formatted_tag = Helper::SemanticVersioningHelper.formatted_tag(current_version, params[:tag_format])
|
26
|
+
|
27
|
+
commits = Helper::SemanticVersioningHelper.git_commits(
|
28
|
+
from: Helper::SemanticVersioningHelper.git_tag_exists?(formatted_tag) ? formatted_tag : nil,
|
29
|
+
allowed_types: params[:allowed_types]
|
30
|
+
)
|
31
|
+
|
32
|
+
bump_type = Helper::SemanticVersioningHelper.bump_type(commits: commits, bump_map: params[:bump_map])
|
33
|
+
new_version = Helper::SemanticVersioningHelper.increase_version(current_version: current_version, bump_type: bump_type)
|
34
|
+
new_changelog = Helper::SemanticVersioningHelper.build_changelog(version: new_version, commits: commits, type_map: params[:type_map])
|
35
|
+
bumpable = current_version != new_version
|
36
|
+
|
37
|
+
Actions.lane_context[SharedValues::SEMVER_CURRENT_VERSION] = current_version
|
38
|
+
Actions.lane_context[SharedValues::SEMVER_CURRENT_TAG] = formatted_tag
|
39
|
+
Actions.lane_context[SharedValues::SEMVER_BUMP_TYPE] = bump_type
|
40
|
+
Actions.lane_context[SharedValues::SEMVER_NEW_VERSION] = new_version
|
41
|
+
Actions.lane_context[SharedValues::SEMVER_NEW_CHANGELOG] = new_changelog
|
42
|
+
Actions.lane_context[SharedValues::SEMVER_BUMPABLE] = bumpable
|
43
|
+
|
44
|
+
return bumpable
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.description
|
48
|
+
"Retrieve semantic versioning information from commit history."
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.authors
|
52
|
+
["kassi"]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.output
|
56
|
+
# Define the shared values you are going to provide
|
57
|
+
[
|
58
|
+
["SEMVER_CURRENT_VERSION", "Current version of the project as provided"],
|
59
|
+
["SEMVER_CURRENT_TAG", "Current tag for the current version number"],
|
60
|
+
["SEMVER_BUMP_TYPE", "Type of version bump. One of major, minor, or patch"],
|
61
|
+
["SEMVER_NEW_VERSION", "New version that would have to be set from current version and commits"],
|
62
|
+
["SEMVER_NEW_CHANGELOG", "New changelog section for the new bump"],
|
63
|
+
["SEMVER_BUMPABLE", "True if a version bump is possible"]
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.return_value
|
68
|
+
# If your method provides a return value, you can describe here what it does
|
69
|
+
"Returns true, if the determined next version is higher than the current one."
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.details
|
73
|
+
# Optional:
|
74
|
+
"Reads commits from last version and determines next version and changelog."
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.available_options
|
78
|
+
[
|
79
|
+
FastlaneCore::ConfigItem.new(key: :allowed_types,
|
80
|
+
env_name: "SEMANTIC_VERSIONING_ALLOWED_TYPES",
|
81
|
+
description: "List of allowed commit types",
|
82
|
+
optional: true,
|
83
|
+
default_value: %w[build ci docs feat fix perf refactor style test chore revert bump init],
|
84
|
+
type: Array),
|
85
|
+
FastlaneCore::ConfigItem.new(key: :bump_map,
|
86
|
+
description: "Map of commit types to their bump level (major, minor, patch)",
|
87
|
+
optional: true,
|
88
|
+
default_value: { breaking: :major, feat: :minor, fix: :patch },
|
89
|
+
is_string: false,
|
90
|
+
verify_block: ->(value) { verify_bump_map(value) }),
|
91
|
+
FastlaneCore::ConfigItem.new(key: :tag_format,
|
92
|
+
env_name: "SEMANTIC_VERSIONING_TAG_FORMAT",
|
93
|
+
description: "The format for the git tag",
|
94
|
+
optional: true,
|
95
|
+
default_value: "$version",
|
96
|
+
type: String),
|
97
|
+
FastlaneCore::ConfigItem.new(key: :type_map,
|
98
|
+
env_name: "SEMANTIC_VERSIONING_TYPE_MAP",
|
99
|
+
description: "Map of types to section titles for the changelog." \
|
100
|
+
"Only the specified types will be used for the changelog",
|
101
|
+
optional: true,
|
102
|
+
default_value: { breaking: "BREAKING CHANGES", feat: "Features", fix: "Bug Fixes" },
|
103
|
+
is_string: false,
|
104
|
+
verify_block: ->(value) { verify_type_map(value) })
|
105
|
+
]
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.verify_type_map(value)
|
109
|
+
UI.user_error!("Parameter 'type_map' must be a Hash.") unless value.kind_of?(Hash)
|
110
|
+
# It could be helpful to also test for valid keys, which must all be part of ConfigItem :allowed_types plus breaking.
|
111
|
+
# How to check this?
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.verify_bump_map(value)
|
115
|
+
UI.user_error!("Parameter 'bump_map' must be a Hash.") unless value.kind_of?(Hash)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.is_supported?(platform)
|
119
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
120
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
121
|
+
#
|
122
|
+
# [:ios, :mac, :android].include?(platform)
|
123
|
+
true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "fastlane/action"
|
2
|
+
require_relative "../helper/semantic_versioning_helper"
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class SemanticBumpAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
unless Actions.lane_context.key?(SharedValues::SEMVER_BUMPABLE)
|
9
|
+
UI.user_error!("No semver information found. Please run get_versioning_info beforehand.")
|
10
|
+
end
|
11
|
+
|
12
|
+
unless Actions.lane_context[SharedValues::SEMVER_BUMPABLE]
|
13
|
+
UI.message("No version bump detected.")
|
14
|
+
return false
|
15
|
+
end
|
16
|
+
|
17
|
+
version_number = Actions.lane_context[SharedValues::SEMVER_NEW_VERSION]
|
18
|
+
next_changelog = Actions.lane_context[SharedValues::SEMVER_NEW_CHANGELOG]
|
19
|
+
|
20
|
+
Fastlane::Actions::IncrementVersionNumberAction.run(version_number: version_number)
|
21
|
+
|
22
|
+
if params[:changelog_file]
|
23
|
+
Helper::SemanticVersioningHelper.write_changelog(
|
24
|
+
path: params[:changelog_file],
|
25
|
+
changelog: next_changelog
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
Fastlane::Actions::CommitVersionBumpAction.run(
|
30
|
+
message: Helper::SemanticVersioningHelper.bump_message(params[:bump_message]),
|
31
|
+
force: true,
|
32
|
+
include: [params[:changelog_file]].compact
|
33
|
+
)
|
34
|
+
|
35
|
+
return true
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.description
|
39
|
+
"Bumps the version according to semantic versioning and writes a changelog."
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.authors
|
43
|
+
["kassi"]
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.output
|
47
|
+
# Define the shared values you are going to provide
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.return_value
|
51
|
+
# If your method provides a return value, you can describe here what it does
|
52
|
+
"Returns true when the bump was successful, false otherwise."
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.details
|
56
|
+
# Optional:
|
57
|
+
"Reads commits from last version and determines next version and changelog."
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.available_options
|
61
|
+
[
|
62
|
+
FastlaneCore::ConfigItem.new(key: :bump_message,
|
63
|
+
env_name: "SEMANTIC_VERSIONING_BUMP_MESSAGE",
|
64
|
+
description: "The commit mesage to use for the bump commit",
|
65
|
+
optional: true,
|
66
|
+
default_value: "version $current_version → $new_version",
|
67
|
+
type: String),
|
68
|
+
FastlaneCore::ConfigItem.new(key: :changelog_file,
|
69
|
+
env_name: "SEMANTIC_VERSIONING_CHANGELOG_FILE",
|
70
|
+
description: "Filename for the changelog",
|
71
|
+
optional: true,
|
72
|
+
default_value: "CHANGELOG.md",
|
73
|
+
type: String)
|
74
|
+
]
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.is_supported?(platform)
|
78
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
79
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
80
|
+
#
|
81
|
+
# [:ios, :mac, :android].include?(platform)
|
82
|
+
true
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
require "fastlane_core/ui/ui"
|
2
|
+
require "fastlane/actions/get_version_number"
|
3
|
+
require "git"
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
|
7
|
+
|
8
|
+
module Helper
|
9
|
+
class SemanticVersioningHelper
|
10
|
+
# class methods that you define here become available in your action
|
11
|
+
# as `Helper::SemanticVersioningHelper.your_method`
|
12
|
+
#
|
13
|
+
def self.show_message
|
14
|
+
UI.message("Hello from the semantic_versioning plugin helper!")
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.version_number
|
18
|
+
Actions::GetVersionNumberAction.run({})
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.formatted_tag(tag, format)
|
22
|
+
format.sub("$version", tag)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.git_tag_exists?(tag)
|
26
|
+
git.tags.include?(tag)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Retrieves git commits and returns them grouped by type
|
30
|
+
def self.git_commits(from:, allowed_types:)
|
31
|
+
logs = from ? git.log(-1).between(from) : git.log(-1)
|
32
|
+
logs.reverse_each.map do |commit|
|
33
|
+
parse_conventional_commit(commit: commit, allowed_types: allowed_types)
|
34
|
+
end.compact
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.group_commits(commits:, allowed_types:)
|
38
|
+
result = allowed_types.to_h { |type| [type, []] }
|
39
|
+
|
40
|
+
commits.each do |commit|
|
41
|
+
if commit[:breaking] && allowed_types.include?(:breaking)
|
42
|
+
result[:breaking] << commit
|
43
|
+
end
|
44
|
+
next unless allowed_types.include?(commit[:type])
|
45
|
+
|
46
|
+
# If the breaking change is made from the actual feature subject, don't repeat it.
|
47
|
+
next if commit[:breaking] == commit[:subject]
|
48
|
+
|
49
|
+
result[commit[:type]] << commit
|
50
|
+
end
|
51
|
+
|
52
|
+
return result
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.bump_type(commits:, bump_map:)
|
56
|
+
result = nil
|
57
|
+
|
58
|
+
commits.each do |commit|
|
59
|
+
bump_type = commit[:breaking] ? bump_map[:breaking] : bump_map[commit[:type]]
|
60
|
+
if bump_type == :major
|
61
|
+
return :major
|
62
|
+
elsif bump_type == :minor
|
63
|
+
result = :minor
|
64
|
+
elsif bump_type == :patch && result.nil?
|
65
|
+
result = :patch
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
return result
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.parse_conventional_commit(commit:, allowed_types:)
|
73
|
+
types = allowed_types.join("|")
|
74
|
+
commit.message.match(/^(?<type>#{types})(\((?<scope>\S+)\))?(?<breaking>!)?:\s+(?<subject>[^\n\r]+)(\z|\n\n(?<body>.*\z))/m) do |match|
|
75
|
+
unless allowed_types.include?(match[:type].to_sym)
|
76
|
+
UI.important("Commit #{commit.sha} has invalid type: #{match[:type]}. Ignoring")
|
77
|
+
break
|
78
|
+
end
|
79
|
+
|
80
|
+
cc = {
|
81
|
+
type: match[:type].to_sym,
|
82
|
+
scope: match[:scope],
|
83
|
+
subject: match[:subject],
|
84
|
+
body: match[:body],
|
85
|
+
breaking: match[:breaking] ? match[:subject] : nil,
|
86
|
+
original_message: commit.message
|
87
|
+
}
|
88
|
+
|
89
|
+
match[:body]&.match(/^BREAKING CHANGE?: (.+)\z/) do |breaking|
|
90
|
+
cc[:breaking] = breaking[1]
|
91
|
+
end
|
92
|
+
|
93
|
+
return cc
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.increase_version(current_version:, bump_type:)
|
98
|
+
version_array = current_version.split(".").map(&:to_i)
|
99
|
+
|
100
|
+
case bump_type
|
101
|
+
when :major
|
102
|
+
version_array[0] += 1
|
103
|
+
version_array[1] = version_array[2] = 0
|
104
|
+
when :minor
|
105
|
+
version_array[1] += 1
|
106
|
+
version_array[2] = 0
|
107
|
+
when :patch
|
108
|
+
version_array[2] += 1
|
109
|
+
end
|
110
|
+
|
111
|
+
return version_array.join(".")
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds and returns th changelog for the upcoming release.
|
115
|
+
def self.build_changelog(version:, commits:, type_map:, name: nil)
|
116
|
+
lines = []
|
117
|
+
|
118
|
+
title = [version, name, Time.now.strftime("(%F)")].compact.join(" ")
|
119
|
+
lines << "## #{title}"
|
120
|
+
lines << ""
|
121
|
+
|
122
|
+
grouped_commits = group_commits(commits: commits, allowed_types: type_map.keys)
|
123
|
+
grouped_commits.each do |key, section_commits|
|
124
|
+
next unless section_commits.any?
|
125
|
+
|
126
|
+
lines << "### #{type_map[key]}:"
|
127
|
+
lines << ""
|
128
|
+
|
129
|
+
section_commits.each do |commit|
|
130
|
+
lines << "- #{key == :breaking ? commit[:breaking] : commit[:subject]}"
|
131
|
+
end
|
132
|
+
|
133
|
+
lines << ""
|
134
|
+
end
|
135
|
+
|
136
|
+
return "#{lines.join("\n")}\n"
|
137
|
+
end
|
138
|
+
|
139
|
+
def self.write_changelog(path:, changelog:)
|
140
|
+
old_changelog = File.new(path).read if File.exist?(path)
|
141
|
+
|
142
|
+
File.open(path, "w") do |file|
|
143
|
+
file.write(changelog)
|
144
|
+
if old_changelog
|
145
|
+
file.write("\n")
|
146
|
+
file.write(old_changelog)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.bump_message(format)
|
152
|
+
format("bump: %s", format
|
153
|
+
.sub("$current_version", Actions.lane_context[Actions::SharedValues::SEMVER_CURRENT_VERSION])
|
154
|
+
.sub("$new_version", Actions.lane_context[Actions::SharedValues::SEMVER_NEW_VERSION]))
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.git_command(args)
|
158
|
+
Actions.sh("git #{args.join(' ')}").chomp
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.git
|
162
|
+
# rubocop:disable Style/ClassVars
|
163
|
+
@@git ||= Git.open(".")
|
164
|
+
# rubocop:enable Style/ClassVars
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "fastlane/plugin/semantic_versioning/version"
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module SemanticVersioning
|
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::SemanticVersioning.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-semantic_versioning
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Karsten Silkenbäumer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description:
|
28
|
+
email: 993392+kassi@users.noreply.github.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- LICENSE
|
34
|
+
- README.md
|
35
|
+
- lib/fastlane/plugin/semantic_versioning.rb
|
36
|
+
- lib/fastlane/plugin/semantic_versioning/actions/get_versioning_info_action.rb
|
37
|
+
- lib/fastlane/plugin/semantic_versioning/actions/semantic_bump_action.rb
|
38
|
+
- lib/fastlane/plugin/semantic_versioning/helper/semantic_versioning_helper.rb
|
39
|
+
- lib/fastlane/plugin/semantic_versioning/version.rb
|
40
|
+
homepage: https://github.com/kassi/fastlane-plugin-semantic_versioning
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata:
|
44
|
+
rubygems_mfa_required: 'true'
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.6'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubygems_version: 3.4.10
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Version and changelog management following semver and conventional commits.
|
64
|
+
test_files: []
|