fastlane-plugin-semantic_versioning 3.0.1 → 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: '098ee381f7cc7a2cfc1f194ed26709b0db70dbb4d4e0532622d40f2db4171886'
4
- data.tar.gz: 31d6ca20e060b09f8a56111a16eb3584a5082f56309a322e52bbd7a73177a12e
3
+ metadata.gz: c69829beea0aa401b5fb31cc490ebecf7d49ffa0430a8c5bc43e05a68c29ef63
4
+ data.tar.gz: 71135c35e0b72fa387f3061dfc64ec6708035678ff335f7d465ab22d588942f8
5
5
  SHA512:
6
- metadata.gz: eca787a771d9229ce6c83674d582be11b08aa14dcc2e88dcb16418e284c4d61a46a50677591c0d3a450d400400caea1bb2f937c3c12c54cb5ad43f7a4832574c
7
- data.tar.gz: 24c6458f5dbb778065b77caaa28b3955ebb1eb44259f84326f9d9c596a153a916e187c8b48c24b7c3ce722b39c4efe95b64607c736767ad3002d637382ab28b1
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)
@@ -123,6 +134,7 @@ module Fastlane
123
134
 
124
135
  def self.increase_version(current_version:, bump_type:)
125
136
  version_array = current_version.split(".").map(&:to_i)
137
+ version_array = version_array.unshift(0, 0)[-3..] # pad from left with zeros when version is not 3-digits.
126
138
 
127
139
  case bump_type
128
140
  when :major
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module SemanticVersioning
5
- VERSION = "3.0.1"
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.1
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