fastlane-plugin-semantic_versioning 3.0.2 → 3.2.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: 8c140874adef71e79de8611605a1729bce035a1618d8ba87e9344b3b34188d88
4
- data.tar.gz: b24fd70c25c5f35c822d4f2f96ba74208a48fe48ed82816140960ff8270b2147
3
+ metadata.gz: e98de4e63d8464ac45f677299cd4770631f19e98e2c9b50fbed75fb2e1a34137
4
+ data.tar.gz: c870636105b753ad4283a7b258f954f93b7e8b757f3ebccf4ef4db20a8918204
5
5
  SHA512:
6
- metadata.gz: f3ca8011cb704bff1a77bd021d0c5f7a00a893feb2b756e1b2abddc464fcf0ee49bc6828d3df431db495a33138c29db1bf967650360134274b6817ff4f5d75f3
7
- data.tar.gz: c3bb306b4e6b3f9d280cfc628ea6b43af4d138c6c2bbfee0512d8fc27e64a3828a09ac2ca1bc42605cc1ededd63afa2fb3af32441ac67b29971b8a3aca3f790b
6
+ metadata.gz: b2ca77ff9d828db81747bcb742936e1a381e3e9aeb8c85fcdcf1ac54975a814439b13328faa55406957ad7ce7e98e4ebd46ae83159310eaf5be930841650193a
7
+ data.tar.gz: 89e91142c4c7553f0057e6f5e13a3343098c53de50ebf2fb5a66dd8c5df7d5520fa287ab32adffc5e6cdd2610eb68840132deac43fb7c0d78d7b117d9eb9ccb7
@@ -24,27 +24,34 @@ module Fastlane
24
24
  params[:bump_map].transform_values!(&:to_sym)
25
25
  params[:force_type] = params[:force_type]&.to_sym
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])
30
-
31
27
  system = lane_context[SharedValues::SEMVER_VERSIONING_SYSTEM] = params[:versioning_system]
28
+ tag_format = params[:tag_format]
32
29
 
33
- current_version = Helper::SemanticVersioningHelper.version_number(system: system)
34
- formatted_tag = Helper::SemanticVersioningHelper.formatted_tag(current_version, params[:tag_format])
30
+ current_version = Helper::SemanticVersioningHelper.current_version(
31
+ tag_format: tag_format,
32
+ update: params[:update],
33
+ system: system,
34
+ target: params[:target]
35
+ )
36
+ formatted_tag = Helper::SemanticVersioningHelper.formatted_tag(current_version, tag_format)
37
+ UI.message("Current version: #{current_version} (#{formatted_tag})")
35
38
 
36
39
  commits = Helper::SemanticVersioningHelper.git_commits(
37
40
  from: Helper::SemanticVersioningHelper.git_tag_exists?(formatted_tag) ? formatted_tag : nil,
38
41
  allowed_types: params[:allowed_types],
39
42
  bump_map: params[:bump_map]
40
43
  )
44
+ UI.message("Found #{commits.length} commit#{commits.length == 1 ? 's' : ''} from last version tag")
41
45
 
42
46
  bump_type = Helper::SemanticVersioningHelper.bump_type(commits: commits, force_type: params[:force_type])
47
+ bump_type ||= Helper::SemanticVersioningHelper.manual_bump_type(skip_manual: params[:skip_manual_bump])
48
+
43
49
  new_version = Helper::SemanticVersioningHelper.increase_version(current_version: current_version,
44
50
  bump_type: bump_type)
45
51
  new_changelog = Helper::SemanticVersioningHelper.build_changelog(version: new_version, commits: commits,
46
52
  type_map: params[:type_map])
47
53
  bumpable = current_version != new_version
54
+ UI.message("New version: #{new_version}") if bumpable
48
55
 
49
56
  Actions.lane_context[SharedValues::SEMVER_CURRENT_VERSION] = current_version
50
57
  Actions.lane_context[SharedValues::SEMVER_CURRENT_TAG] = formatted_tag
@@ -110,12 +117,23 @@ module Fastlane
110
117
  optional: true,
111
118
  default_value: nil,
112
119
  type: String),
120
+ FastlaneCore::ConfigItem.new(key: :skip_manual_bump,
121
+ env_name: "SEMANTIC_VERSIONING_SKIP_MANUAL_BUMP",
122
+ description: "When set, no interactive prompt is shown when there's no version to bump",
123
+ optional: true,
124
+ default_value: false,
125
+ is_string: false),
113
126
  FastlaneCore::ConfigItem.new(key: :tag_format,
114
127
  env_name: "SEMANTIC_VERSIONING_TAG_FORMAT",
115
128
  description: "The format for the git tag",
116
129
  optional: true,
117
130
  default_value: "$version",
118
131
  type: String),
132
+ FastlaneCore::ConfigItem.new(key: :target,
133
+ env_name: "SEMANTIC_VERSIONING_TARGET",
134
+ description: "Name of the target to use for manual versioning system",
135
+ optional: true,
136
+ type: String),
119
137
  FastlaneCore::ConfigItem.new(key: :type_map,
120
138
  env_name: "SEMANTIC_VERSIONING_TYPE_MAP",
121
139
  description: "Map of types to section titles for the changelog." \
@@ -125,6 +143,14 @@ module Fastlane
125
143
  fix: "Bug Fixes" },
126
144
  is_string: false,
127
145
  verify_block: ->(value) { verify_type_map(value) }),
146
+ FastlaneCore::ConfigItem.new(key: :update,
147
+ env_name: "SEMANTIC_VERSIONING_UPDATE",
148
+ description: "When set, the changelog is determined from the previous rather than current version." \
149
+ "This is useful when being on a release branch where new commits are added to the " \
150
+ "current release",
151
+ optional: true,
152
+ default_value: false,
153
+ is_string: false),
128
154
  FastlaneCore::ConfigItem.new(key: :versioning_system,
129
155
  env_name: "SEMANTIC_VERSIONING_VERSIONING_SYSTEM",
130
156
  description: "Type of versioning to use. Can be 'manual' or 'apple-generic'." \
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "fastlane_core/ui/ui"
4
4
  require "fastlane/actions/get_version_number"
5
+ require "fastlane/actions/last_git_tag"
5
6
  require "fastlane/plugin/versioning"
6
7
  require "git"
7
8
  require "xcodeproj"
@@ -14,11 +15,11 @@ module Fastlane
14
15
  # class methods that you define here become available in your action
15
16
  # as `Helper::SemanticVersioningHelper.your_method`
16
17
  #
17
- def self.version_number(system:)
18
+ def self.version_number(system:, target:)
18
19
  if system == "apple-generic"
19
20
  Actions::GetVersionNumberAction.run({})
20
21
  else
21
- Actions::GetVersionNumberFromXcodeprojAction.run({})
22
+ Actions::GetVersionNumberFromXcodeprojAction.run(target: target)
22
23
  end
23
24
  end
24
25
 
@@ -30,6 +31,24 @@ module Fastlane
30
31
  end
31
32
  end
32
33
 
34
+ def self.current_version(tag_format:, update:, system:, target:)
35
+ if update
36
+ Helper::SemanticVersioningHelper.previous_version(tag_format: tag_format)
37
+ else
38
+ Helper::SemanticVersioningHelper.version_number(system: system, target: target)
39
+ end
40
+ end
41
+
42
+ def self.previous_version(tag_format:)
43
+ tag = Fastlane::Actions::LastGitTagAction.run(pattern: tag_format.sub("$version", "[0-9].[0-9].[0-9]"))
44
+ return "0.0.0" if tag.empty?
45
+
46
+ regex = tag_format.sub("$version", "(?<version>\\d+\\.\\d+\\.\\d+)")
47
+ tag.match(regex) do |match|
48
+ return match[:version]
49
+ end
50
+ end
51
+
33
52
  def self.verify_versioning_system(value)
34
53
  allowed = %w[apple-generic manual]
35
54
  return if allowed.include?(value)
@@ -101,6 +120,17 @@ module Fastlane
101
120
  result
102
121
  end
103
122
 
123
+ def self.manual_bump_type(skip_manual:)
124
+ return if skip_manual
125
+
126
+ UI.message("No new version to bump")
127
+ if !Helper.test? && UI.interactive?
128
+ return UI.select("If you do want to create a new version, select which type:", [:major, :minor, :patch, nil])
129
+ end
130
+
131
+ nil
132
+ end
133
+
104
134
  def self.group_commits(commits:, allowed_types:)
105
135
  result = allowed_types.to_h { |type| [type, []] }
106
136
  result[:none] = []
@@ -189,7 +219,7 @@ module Fastlane
189
219
  end
190
220
 
191
221
  def self.git_tag_exists?(tag)
192
- git.tags.include?(tag)
222
+ git.tags.map(&:name).include?(tag)
193
223
  end
194
224
 
195
225
  def self.project(path = nil)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module SemanticVersioning
5
- VERSION = "3.0.2"
5
+ VERSION = "3.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-semantic_versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karsten Silkenbäumer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2026-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane-plugin-versioning
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.24'
55
- description:
55
+ description:
56
56
  email: 993392+kassi@users.noreply.github.com
57
57
  executables: []
58
58
  extensions: []
@@ -71,7 +71,7 @@ licenses:
71
71
  - MIT
72
72
  metadata:
73
73
  rubygems_mfa_required: 'true'
74
- post_install_message:
74
+ post_install_message:
75
75
  rdoc_options: []
76
76
  require_paths:
77
77
  - lib
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubygems_version: 3.4.10
90
- signing_key:
90
+ signing_key:
91
91
  specification_version: 4
92
92
  summary: Version and changelog management following semver and conventional commits.
93
93
  test_files: []