fastlane-plugin-semantic_versioning 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c140874adef71e79de8611605a1729bce035a1618d8ba87e9344b3b34188d88
4
- data.tar.gz: b24fd70c25c5f35c822d4f2f96ba74208a48fe48ed82816140960ff8270b2147
3
+ metadata.gz: c69829beea0aa401b5fb31cc490ebecf7d49ffa0430a8c5bc43e05a68c29ef63
4
+ data.tar.gz: 71135c35e0b72fa387f3061dfc64ec6708035678ff335f7d465ab22d588942f8
5
5
  SHA512:
6
- metadata.gz: f3ca8011cb704bff1a77bd021d0c5f7a00a893feb2b756e1b2abddc464fcf0ee49bc6828d3df431db495a33138c29db1bf967650360134274b6817ff4f5d75f3
7
- data.tar.gz: c3bb306b4e6b3f9d280cfc628ea6b43af4d138c6c2bbfee0512d8fc27e64a3828a09ac2ca1bc42605cc1ededd63afa2fb3af32441ac67b29971b8a3aca3f790b
6
+ metadata.gz: 52bd6b35613e1369344ca83c53d0fca579e288413e9d1637f3205abbbf3c00003e158ee785d4c58bc1c29a3383dd4bf8b35c31c0886ace96bac3857e810f3aea
7
+ data.tar.gz: f0c43b718ddb28d6ca01f4766dc33a05c729b3a0438050798bb2ec2b09f6515bc28e407986789fb1c231d56c54744b056c53d345d92190ed7dc8fb2fdb7f51d2
@@ -29,8 +29,13 @@ module Fastlane
29
29
  Helper::SemanticVersioningHelper.verify_versioning_system(params[:versioning_system])
30
30
 
31
31
  system = lane_context[SharedValues::SEMVER_VERSIONING_SYSTEM] = params[:versioning_system]
32
+ target = params[:target]
32
33
 
33
- current_version = Helper::SemanticVersioningHelper.version_number(system: system)
34
+ current_version = if params[:update]
35
+ Helper::SemanticVersioningHelper.previous_version(tag_format: params[:tag_format])
36
+ else
37
+ Helper::SemanticVersioningHelper.version_number(system: system, target: target)
38
+ end
34
39
  formatted_tag = Helper::SemanticVersioningHelper.formatted_tag(current_version, params[:tag_format])
35
40
 
36
41
  commits = Helper::SemanticVersioningHelper.git_commits(
@@ -116,6 +121,11 @@ module Fastlane
116
121
  optional: true,
117
122
  default_value: "$version",
118
123
  type: String),
124
+ FastlaneCore::ConfigItem.new(key: :target,
125
+ env_name: "SEMANTIC_VERSIONING_TARGET",
126
+ description: "Name of the target to use for manual versioning system",
127
+ optional: true,
128
+ type: String),
119
129
  FastlaneCore::ConfigItem.new(key: :type_map,
120
130
  env_name: "SEMANTIC_VERSIONING_TYPE_MAP",
121
131
  description: "Map of types to section titles for the changelog." \
@@ -125,6 +135,14 @@ module Fastlane
125
135
  fix: "Bug Fixes" },
126
136
  is_string: false,
127
137
  verify_block: ->(value) { verify_type_map(value) }),
138
+ FastlaneCore::ConfigItem.new(key: :update,
139
+ env_name: "SEMANTIC_VERSIONING_UPDATE",
140
+ description: "When set, the changelog is determined from the previous rather than current version." \
141
+ "This is useful when being on a release branch where new commits are added to the " \
142
+ "current release",
143
+ optional: true,
144
+ default_value: false,
145
+ is_string: false),
128
146
  FastlaneCore::ConfigItem.new(key: :versioning_system,
129
147
  env_name: "SEMANTIC_VERSIONING_VERSIONING_SYSTEM",
130
148
  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,16 @@ module Fastlane
30
31
  end
31
32
  end
32
33
 
34
+ def self.previous_version(tag_format:)
35
+ tag = Fastlane::Actions::LastGitTagAction.run(pattern: tag_format.sub("$version", "[0-9].[0-9].[0-9]"))
36
+ return "0.0.0" if tag.empty?
37
+
38
+ regex = tag_format.sub("$version", "(?<version>\\d+\\.\\d+\\.\\d+)")
39
+ tag.match(regex) do |match|
40
+ return match[:version]
41
+ end
42
+ end
43
+
33
44
  def self.verify_versioning_system(value)
34
45
  allowed = %w[apple-generic manual]
35
46
  return if allowed.include?(value)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module SemanticVersioning
5
- VERSION = "3.0.2"
5
+ VERSION = "3.1.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.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karsten Silkenbäumer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2024-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane-plugin-versioning