fastlane-plugin-semantic_versioning 2.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/semantic_versioning/actions/get_versioning_info_action.rb +20 -6
- data/lib/fastlane/plugin/semantic_versioning/actions/semantic_bump_action.rb +16 -5
- data/lib/fastlane/plugin/semantic_versioning/helper/semantic_versioning_helper.rb +20 -8
- data/lib/fastlane/plugin/semantic_versioning/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c974c8e59adc155a1442566a6198e81d8192a85c2f0822cf20acccf8d3c6a320
|
4
|
+
data.tar.gz: 61060c47ebc660fdec7999392e05b7ee7303212b14cee2f414058579d7ee0840
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bca9ec5b145f927fab9a16bf6483b988133a30c7e4032ff756d3acbc24dffb3eae18b86ff02d1dcaa17293fd4077eab28a5f23ee3734401303fb1092dd2027e1
|
7
|
+
data.tar.gz: 4f04bc1f080a83b49d548a4e011692d0482c60dbc95e3601781f0239e672924ee1495ee4ebf114461dbef5cdbf627bbf1f24e75fc0fb70eb0b91816742080584
|
@@ -13,6 +13,7 @@ module Fastlane
|
|
13
13
|
SEMVER_NEW_VERSION = :SEMVER_NEW_VERSION
|
14
14
|
SEMVER_NEW_CHANGELOG = :SEMVER_NEW_CHANGELOG
|
15
15
|
SEMVER_BUMPABLE = :SEMVER_BUMPABLE
|
16
|
+
SEMVER_VERSIONING_SYSTEM = :SEMVER_VERSIONING_SYSTEM
|
16
17
|
end
|
17
18
|
|
18
19
|
# Action to retrieve semantic versioning information from commit history.
|
@@ -23,9 +24,13 @@ module Fastlane
|
|
23
24
|
params[:bump_map].transform_values!(&:to_sym)
|
24
25
|
params[:force_type] = params[:force_type]&.to_sym
|
25
26
|
|
26
|
-
|
27
|
+
verify_type_map(params[:type_map])
|
28
|
+
verify_bump_map(params[:bump_map])
|
29
|
+
Helper::SemanticVersioningHelper.verify_versioning_system(params[:versioning_system])
|
27
30
|
|
28
|
-
|
31
|
+
system = lane_context[SharedValues::SEMVER_VERSIONING_SYSTEM] = params[:versioning_system]
|
32
|
+
|
33
|
+
current_version = Helper::SemanticVersioningHelper.version_number(system: system)
|
29
34
|
formatted_tag = Helper::SemanticVersioningHelper.formatted_tag(current_version, params[:tag_format])
|
30
35
|
|
31
36
|
commits = Helper::SemanticVersioningHelper.git_commits(
|
@@ -68,7 +73,8 @@ module Fastlane
|
|
68
73
|
["SEMVER_BUMP_TYPE", "Type of version bump. One of major, minor, or patch"],
|
69
74
|
["SEMVER_NEW_VERSION", "New version that would have to be set from current version and commits"],
|
70
75
|
["SEMVER_NEW_CHANGELOG", "New changelog section for the new bump"],
|
71
|
-
["SEMVER_BUMPABLE", "True if a version bump is possible"]
|
76
|
+
["SEMVER_BUMPABLE", "True if a version bump is possible"],
|
77
|
+
["SEMVER_VERSIONING_SYSTEM", "The versioning system used"]
|
72
78
|
]
|
73
79
|
end
|
74
80
|
|
@@ -118,7 +124,16 @@ module Fastlane
|
|
118
124
|
default_value: { breaking: "BREAKING CHANGES", feat: "Features",
|
119
125
|
fix: "Bug Fixes" },
|
120
126
|
is_string: false,
|
121
|
-
verify_block: ->(value) { verify_type_map(value) })
|
127
|
+
verify_block: ->(value) { verify_type_map(value) }),
|
128
|
+
FastlaneCore::ConfigItem.new(key: :versioning_system,
|
129
|
+
env_name: "SEMANTIC_VERSIONING_VERSIONING_SYSTEM",
|
130
|
+
description: "Type of versioning to use. Can be 'manual' or 'apple-generic'." \
|
131
|
+
"For 'apple-generic', the project has to be prepared with prepare_versioning." \
|
132
|
+
"Defaults to 'manual'",
|
133
|
+
optional: true,
|
134
|
+
default_value: "manual",
|
135
|
+
is_string: true,
|
136
|
+
verify_block: ->(value) { Helper::SemanticVersioningHelper.verify_versioning_system(value) })
|
122
137
|
]
|
123
138
|
end
|
124
139
|
|
@@ -135,8 +150,7 @@ module Fastlane
|
|
135
150
|
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
136
151
|
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
137
152
|
#
|
138
|
-
|
139
|
-
true
|
153
|
+
%i[ios mac].include?(platform)
|
140
154
|
end
|
141
155
|
# :nocov:
|
142
156
|
end
|
@@ -8,19 +8,22 @@ module Fastlane
|
|
8
8
|
# Action to bumps the version according to semantic versioning and writes a changelog.
|
9
9
|
class SemanticBumpAction < Action
|
10
10
|
def self.run(params)
|
11
|
-
unless Actions.lane_context.key?(SharedValues::SEMVER_BUMPABLE)
|
11
|
+
unless Actions.lane_context.key?(SharedValues::SEMVER_BUMPABLE) && Actions.lane_context.key?(SharedValues::SEMVER_VERSIONING_SYSTEM)
|
12
12
|
UI.user_error!("No semver information found. Please run get_versioning_info beforehand.")
|
13
13
|
end
|
14
14
|
|
15
|
+
Helper::SemanticVersioningHelper.verify_versioning_system(Actions.lane_context[SharedValues::SEMVER_VERSIONING_SYSTEM])
|
16
|
+
|
15
17
|
unless Actions.lane_context[SharedValues::SEMVER_BUMPABLE]
|
16
18
|
UI.message("No version bump detected.")
|
17
19
|
return false
|
18
20
|
end
|
19
21
|
|
22
|
+
system = Actions.lane_context[SharedValues::SEMVER_VERSIONING_SYSTEM]
|
20
23
|
version_number = Actions.lane_context[SharedValues::SEMVER_NEW_VERSION]
|
21
24
|
next_changelog = Actions.lane_context[SharedValues::SEMVER_NEW_CHANGELOG]
|
22
25
|
|
23
|
-
|
26
|
+
Helper::SemanticVersioningHelper.set_version_number(version_number: version_number, system: system)
|
24
27
|
|
25
28
|
if params[:changelog_file]
|
26
29
|
Helper::SemanticVersioningHelper.write_changelog(
|
@@ -75,7 +78,16 @@ module Fastlane
|
|
75
78
|
description: "Filename for the changelog",
|
76
79
|
optional: true,
|
77
80
|
default_value: "CHANGELOG.md",
|
78
|
-
type: String)
|
81
|
+
type: String),
|
82
|
+
FastlaneCore::ConfigItem.new(key: :versioning_system,
|
83
|
+
env_name: "SEMANTIC_VERSIONING_VERSIONING_SYSTEM",
|
84
|
+
description: "Type of versioning to use. Can be 'manual' or 'apple-generic'." \
|
85
|
+
"For 'apple-generic', the project has to be prepared with prepare_versioning." \
|
86
|
+
"Defaults to 'manual'",
|
87
|
+
optional: true,
|
88
|
+
default_value: "manual",
|
89
|
+
is_string: true,
|
90
|
+
verify_block: ->(value) { Helper::SemanticVersioningHelper.verify_versioning_system(value) })
|
79
91
|
]
|
80
92
|
end
|
81
93
|
|
@@ -84,8 +96,7 @@ module Fastlane
|
|
84
96
|
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
85
97
|
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
86
98
|
#
|
87
|
-
|
88
|
-
true
|
99
|
+
%i[ios mac].include?(platform)
|
89
100
|
end
|
90
101
|
# :nocov:
|
91
102
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "fastlane_core/ui/ui"
|
4
4
|
require "fastlane/actions/get_version_number"
|
5
|
+
require "fastlane/plugin/versioning"
|
5
6
|
require "git"
|
6
7
|
require "xcodeproj"
|
7
8
|
|
@@ -13,12 +14,27 @@ module Fastlane
|
|
13
14
|
# class methods that you define here become available in your action
|
14
15
|
# as `Helper::SemanticVersioningHelper.your_method`
|
15
16
|
#
|
16
|
-
def self.
|
17
|
-
|
17
|
+
def self.version_number(system:)
|
18
|
+
if system == "apple-generic"
|
19
|
+
Actions::GetVersionNumberAction.run({})
|
20
|
+
else
|
21
|
+
Actions::GetVersionNumberFromXcodeprojAction.run({})
|
22
|
+
end
|
18
23
|
end
|
19
24
|
|
20
|
-
def self.version_number
|
21
|
-
|
25
|
+
def self.set_version_number(version_number:, system:)
|
26
|
+
if system == "apple-generic"
|
27
|
+
Fastlane::Actions::IncrementVersionNumberAction.run(version_number: version_number)
|
28
|
+
else
|
29
|
+
Actions::IncrementVersionNumberInXcodeprojAction.run(version_number: version_number)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.verify_versioning_system(value)
|
34
|
+
allowed = %w[apple-generic manual]
|
35
|
+
return if allowed.include?(value)
|
36
|
+
|
37
|
+
UI.user_error!("'versioning_system' must be one of #{allowed}")
|
22
38
|
end
|
23
39
|
|
24
40
|
def self.formatted_tag(tag, format)
|
@@ -185,10 +201,6 @@ module Fastlane
|
|
185
201
|
project.targets.first
|
186
202
|
end
|
187
203
|
|
188
|
-
def self.current_version
|
189
|
-
@current_version ||= main_target.build_configurations.first.build_settings["MARKETING_VERSION"] || "1.0"
|
190
|
-
end
|
191
|
-
|
192
204
|
def self.main_group(name = nil)
|
193
205
|
project.main_group[name || main_target.name]
|
194
206
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-semantic_versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karsten Silkenbäumer
|
@@ -10,6 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fastlane-plugin-versioning
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: git
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|