fastlane-plugin-semantic_versioning 2.1.1 → 3.0.1

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: 0d962764d77e655baf9b60aae168bcf8ad44bbaa72f086459a289fec254ccdf7
4
- data.tar.gz: 3880d7197a78a347153559ace10fc8ac2d9a70964327c01a698da27928482f0f
3
+ metadata.gz: '098ee381f7cc7a2cfc1f194ed26709b0db70dbb4d4e0532622d40f2db4171886'
4
+ data.tar.gz: 31d6ca20e060b09f8a56111a16eb3584a5082f56309a322e52bbd7a73177a12e
5
5
  SHA512:
6
- metadata.gz: 3c3b6f1b6adec4767c6a713cd73cca76f11e4953fcb65045773f7743abf631241b4c734b5418a0fcd483d2a8f44e88a0bec90c7e57ddbe70e181936b9774dbce
7
- data.tar.gz: beef78408a0e60a49d8519304e58a07381afff3239f6ee3b8df65d64669d24f2872793864e34640911dc4d359488cc0bdceddf967552fcfe7f4185c5399b3616
6
+ metadata.gz: eca787a771d9229ce6c83674d582be11b08aa14dcc2e88dcb16418e284c4d61a46a50677591c0d3a450d400400caea1bb2f937c3c12c54cb5ad43f7a4832574c
7
+ data.tar.gz: 24c6458f5dbb778065b77caaa28b3955ebb1eb44259f84326f9d9c596a153a916e187c8b48c24b7c3ce722b39c4efe95b64607c736767ad3002d637382ab28b1
@@ -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
- UI.message("The semantic_versioning plugin is working!")
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
- current_version = Helper::SemanticVersioningHelper.version_number
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
 
@@ -130,15 +145,12 @@ module Fastlane
130
145
  UI.user_error!("Parameter 'bump_map' must be a Hash.") unless value.is_a?(Hash)
131
146
  end
132
147
 
133
- # :nocov:
134
- def self.is_supported?(_platform)
148
+ def self.is_supported?(platform)
135
149
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
136
150
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
137
151
  #
138
- # [:ios, :mac, :android].include?(platform)
139
- true
152
+ %i[ios mac].include?(platform)
140
153
  end
141
- # :nocov:
142
154
  end
143
155
  end
144
156
  end
@@ -84,14 +84,12 @@ module Fastlane
84
84
  ]
85
85
  end
86
86
 
87
- # :nocov:
88
87
  def self.is_supported?(platform)
89
88
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
90
89
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
91
90
  #
92
91
  %i[ios mac].include?(platform)
93
92
  end
94
- # :nocov:
95
93
  end
96
94
  end
97
95
  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
- Fastlane::Actions::IncrementVersionNumberAction.run(version_number: version_number)
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,19 +78,25 @@ 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
 
82
- # :nocov:
83
- def self.is_supported?(_platform)
94
+ def self.is_supported?(platform)
84
95
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
85
96
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
86
97
  #
87
- # [:ios, :mac, :android].include?(platform)
88
- true
98
+ %i[ios mac].include?(platform)
89
99
  end
90
- # :nocov:
91
100
  end
92
101
  end
93
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.show_message
17
- UI.message("Hello from the semantic_versioning plugin helper!")
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
- Actions::GetVersionNumberAction.run({})
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module SemanticVersioning
5
- VERSION = "2.1.1"
5
+ VERSION = "3.0.1"
6
6
  end
7
7
  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: 2.1.1
4
+ version: 3.0.1
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