fastlane-plugin-versioning 0.4.5 → 0.5.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: a1f3c3811fd467e7d69c94314d4847e624fb962f5b32b52bc0f1e752b3fc6255
4
- data.tar.gz: 3ef305e276491b37de4c7f7067fc8e1e5d0f6e10ce4fe36b5ad5ddc9e5d2809c
3
+ metadata.gz: 3b859783ec3eb0b788723835e3e9cea700b5924d1993a398f1381c319f4393d9
4
+ data.tar.gz: 3820aef2545a4054830e859c02497d4a8110a8931020758c123775113d15d96b
5
5
  SHA512:
6
- metadata.gz: c26a7e8269c4d60aabab4d1c04323cedbd91c74df6042431275537fe1f3b6496526d66a93f317e60cd7b79d3db7c1b0c2cf9c40986b6b0dddef41f044e4f2509
7
- data.tar.gz: fe91e4da9d9aeccb554f81bd9160bd40e41aea4414f68be97340ec26524c822af0737191d21c02d7d85c0cae922ad3088fda94f47ab352cc782f4ca64b839eb0
6
+ metadata.gz: a33054f02eb1fad905b17d001aaddfd82c4fecae4b8f203be72ae5d65129019ecea32445e6d53e1ae375828651019de0ae1833abbb7c6bb49f86743df036d692
7
+ data.tar.gz: 07a216fd6beca44bf81e57b8ee5ecef852094ca3589882d1ff983683022b0efa118ccb6be84814a0a4083d21a35363aa6a28b75904a8887ae359ece31b20b38c
data/README.md CHANGED
@@ -21,12 +21,18 @@ To make your scheme shared go to "Manage schemes" in Xcode and tick "Shared" che
21
21
 
22
22
 
23
23
  ### what is this `plist_build_setting_support` stuff about?!
24
- If you have a xcodeproject and have updated to Xcode 11, you'll notice that if you change your build and version numbers through the UI, the actual numbers are now stored inside build settings inside build confiugration. The Info.plist file -- where they used to be stored -- now contains build setting variables (looks like `$(CURRENT_PROJECT_VERSION)` or `$(MARKETING_VERSION)`, for build number and version number respectively).
24
+ If you have a xcodeproject and have updated to Xcode 11, you'll notice that if you change your build and version numbers through the UI, the actual numbers are now stored inside build settings inside build configuration. The Info.plist file -- where they used to be stored -- now contains build setting variables (looks like `$(CURRENT_PROJECT_VERSION)` or `$(MARKETING_VERSION)`, for build number and version number respectively).
25
25
  If you are at this migration 'turning point', you have two options. you can either:
26
- 1. simply add `plist_build_setting_support: true` to your plist action parameters
27
- 2. change the command to be the xcodeproj variants - i.e. `increment_version_number_in_xcodeproj` or `increment_build_number_in_xcodeproj`
28
26
 
29
- these also apply to the `getters` of build and version numbers.
27
+ - Continue using the legacy method of inserting build and versions directly into plists by simply add `plist_build_setting_support: true` to your plist action parameters
28
+
29
+ OR
30
+
31
+ - Change the command to be the xcodeproj variants - i.e. `increment_version_number_in_xcodeproj` or `increment_build_number_in_xcodeproj` these also apply to the `getters` of build and version numbers.
32
+
33
+ ##### Warning for those migrating
34
+ Verify your plist files are using the build variables (new) `$(CURRENT_PROJECT_VERSION)` or `$(MARKETING_VERSION)`. You can force this migration by simply modifying Version/Build fields for each one of your targets in UI. If you forget to make this change, or something else is writing and replacing it, xcodeproj actions will successfully update, but your build will have no reference to those values essentially becoming NOOP
35
+
30
36
  We will leave the plist actions in, as for those consumers who are limited to their upgrade path.
31
37
 
32
38
  ## Actions
@@ -57,6 +63,13 @@ increment_version_number_in_plist(
57
63
  # Automatically increment patch version number. Use App Store version number as a source.
58
64
  version_source: 'appstore'
59
65
  )
66
+ increment_version_number_in_plist(
67
+ # Automatically increment patch version number. Use App Store version number as a source.
68
+ version_source: 'appstore',
69
+ # optional two letter country code:
70
+ # specify if availability of your app is limited to a certain country
71
+ country: 'at'
72
+ )
60
73
 
61
74
  increment_version_number_in_plist(
62
75
  # specify specific version number (optional, omitting it increments patch version number)
@@ -108,13 +121,28 @@ version = get_version_number_from_plist(xcodeproj: 'Project.xcodeproj', # option
108
121
 
109
122
  ```ruby
110
123
  version = get_app_store_version_number(xcodeproj: 'Project.xcodeproj', # optional
111
- target: 'TestTarget', # optional, or `scheme`
112
- # optional, must be specified if you have different Info.plist build settings
113
- # for different build configurations
114
- build_configuration_name: 'Release')
115
- )
124
+ target: 'TestTarget', # optional, or `scheme`
125
+ # optional, must be specified if you have different Info.plist build settings
126
+ # for different build configurations
127
+ build_configuration_name: 'Release')
128
+
129
+ version = get_app_store_version_number(xcodeproj: 'Project.xcodeproj', # optional
130
+ target: 'TestTarget', # optional, or `scheme`
131
+ # optional, must be specified if you have different Info.plist build settings
132
+ # for different build configurations
133
+ build_configuration_name: 'Release',
134
+ # optional, must be specified for the lookup to succeed,
135
+ # if your app is only published to one country
136
+ # passed value must be a country code
137
+ country: 'at')
138
+
116
139
  version = get_app_store_version_number(bundle_id: 'com.apple.Numbers')
117
140
 
141
+ version = get_app_store_version_number(bundle_id: 'com.apple.Numbers',
142
+ # optional two letter country code:
143
+ # specify if availability of your app is limited to a certain country
144
+ country: 'at')
145
+
118
146
  ```
119
147
 
120
148
  ### get_version_number_from_git_branch
@@ -204,6 +232,13 @@ increment_version_number_in_xcodeproj(
204
232
  # Automatically increment patch version number. Use App Store version number as a source.
205
233
  version_source: 'appstore'
206
234
  )
235
+ increment_version_number_in_xcodeproj(
236
+ # Automatically increment patch version number. Use App Store version number as a source.
237
+ version_source: 'appstore',
238
+ # optional two letter country code:
239
+ # specify if availability of your app is limited to a certain country
240
+ country: 'at'
241
+ )
207
242
 
208
243
  increment_version_number_in_xcodeproj(
209
244
  # specify specific version number (optional, omitting it increments patch version number)
@@ -273,6 +308,14 @@ increment_build_number_in_plist(
273
308
 
274
309
  ## Issues and Feedback
275
310
 
311
+ ### SwiftPM
312
+
313
+ SwiftPM can be tedious when using this plugin, at least in terms of git history and `xcodeproj`s. Up until recently, there were a number of annoyances caused by this plugin (and a downstream dependency of it) because writing to a project file would clobber some of the comment metadata inside of the project file and replace them - leaving you with the actual version change, but a number of other, less desirable changes too to hand pick through (or give up this plugin for). The advice is, update to `>= 0.4.6` of this plugin, and follow [this advice](https://github.com/SiarheiFedartsou/fastlane-plugin-versioning/issues/59#issuecomment-878255057) - which is to make sure not to include the `.git` at the end of your SwiftPM dependency URLs.
314
+
315
+ ### New / Fresh projects
316
+
317
+ Note that you will need to set the build and version numbers through Xcode's UI at least once to use this plugin without weird `nil:NilClass` issues. See this [issue](https://github.com/SiarheiFedartsou/fastlane-plugin-versioning/issues/60) for context
318
+
276
319
  For any other issues and feedback about this plugin, please submit it to this repository.
277
320
 
278
321
  ## Troubleshooting
@@ -50,6 +50,10 @@ module Fastlane
50
50
  return ENV['APPVEYOR_BUILD_NUMBER']
51
51
  end
52
52
 
53
+ if ENV.key?('GITHUB_RUN_NUMBER')
54
+ return ENV['GITHUB_RUN_NUMBER']
55
+ end
56
+
53
57
  UI.error("Cannot detect current CI build number. Defaulting to \"1\".")
54
58
  "1"
55
59
  end
@@ -16,7 +16,11 @@ module Fastlane
16
16
  bundle_id = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleIdentifier') # TODO: add same kind of flag to support build setting variables
17
17
  end
18
18
 
19
- uri = URI("http://itunes.apple.com/lookup?bundleId=#{bundle_id}")
19
+ if params[:country]
20
+ uri = URI("http://itunes.apple.com/lookup?bundleId=#{bundle_id}&country=#{params[:country]}")
21
+ else
22
+ uri = URI("http://itunes.apple.com/lookup?bundleId=#{bundle_id}")
23
+ end
20
24
  Net::HTTP.get(uri)
21
25
 
22
26
  response = Net::HTTP.get_response(uri)
@@ -66,7 +70,11 @@ module Fastlane
66
70
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
67
71
  optional: true,
68
72
  conflicting_options: [:bundle_id],
69
- description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration")
73
+ description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration"),
74
+ FastlaneCore::ConfigItem.new(key: :country,
75
+ optional: true,
76
+ description: "Pass an optional country code, if your app's availability is limited to specific countries",
77
+ is_string: true)
70
78
  ]
71
79
  end
72
80
 
@@ -34,7 +34,7 @@ module Fastlane
34
34
 
35
35
  private_class_method
36
36
  def self.select_build_configuration_predicate(name, configuration)
37
- is_build_valid_configuration = configuration.isa == "XCBuildConfiguration" && !configuration.build_settings["PRODUCT_BUNDLE_IDENTIFIER"].nil?
37
+ is_build_valid_configuration = configuration.isa == "XCBuildConfiguration" && !configuration.resolve_build_setting('PRODUCT_BUNDLE_IDENTIFIER').nil?
38
38
  is_build_valid_configuration &&= configuration.name == name unless name.nil?
39
39
  return is_build_valid_configuration
40
40
  end
@@ -41,7 +41,7 @@ module Fastlane
41
41
 
42
42
  private_class_method
43
43
  def self.select_build_configuration_predicate(name, configuration)
44
- is_build_valid_configuration = configuration.isa == "XCBuildConfiguration" && !configuration.build_settings["PRODUCT_BUNDLE_IDENTIFIER"].nil?
44
+ is_build_valid_configuration = configuration.isa == "XCBuildConfiguration" && !configuration.resolve_build_setting('PRODUCT_BUNDLE_IDENTIFIER').nil?
45
45
  is_build_valid_configuration &&= configuration.name == name unless name.nil?
46
46
  return is_build_valid_configuration
47
47
  end
@@ -59,10 +59,16 @@ module Fastlane
59
59
  target = project.targets[0] if target.nil?
60
60
  end
61
61
 
62
- target.build_configurations.each do |config|
62
+ if params[:build_configuration_name]
63
+ config = target.build_configurations.detect { |c| c.name == params[:build_configuration_name]}
63
64
  UI.message "updating #{config.name} to build #{next_build_number}"
64
65
  config.build_settings["CURRENT_PROJECT_VERSION"] = next_build_number
65
- end unless target.nil?
66
+ else
67
+ target.build_configurations.each do |config|
68
+ UI.message "updating #{config.name} to build #{next_build_number}"
69
+ config.build_settings["CURRENT_PROJECT_VERSION"] = next_build_number
70
+ end unless target.nil?
71
+ end
66
72
 
67
73
  project.save
68
74
  end
@@ -129,6 +129,10 @@ module Fastlane
129
129
  UI.user_error!("Available values are 'plist' and 'appstore'") unless ['plist', 'appstore'].include? value
130
130
  end,
131
131
  description: "Source version to increment. Available options: plist, appstore"),
132
+ FastlaneCore::ConfigItem.new(key: :country,
133
+ optional: true,
134
+ description: "Pass an optional country code, if your app's availability is limited to specific countries",
135
+ is_string: true),
132
136
  FastlaneCore::ConfigItem.new(key: :plist_build_setting_support,
133
137
  description: "support automatic resolution of build setting from xcodeproj if not a literal value in the plist",
134
138
  is_string: false,
@@ -61,7 +61,7 @@ module Fastlane
61
61
 
62
62
  private_class_method
63
63
  def self.select_build_configuration_predicate(name, configuration)
64
- is_build_valid_configuration = configuration.isa == "XCBuildConfiguration" && !configuration.build_settings["PRODUCT_BUNDLE_IDENTIFIER"].nil?
64
+ is_build_valid_configuration = configuration.isa == "XCBuildConfiguration" && !configuration.resolve_build_setting('PRODUCT_BUNDLE_IDENTIFIER').nil?
65
65
  is_build_valid_configuration &&= configuration.name == name unless name.nil?
66
66
  return is_build_valid_configuration
67
67
  end
@@ -79,10 +79,17 @@ module Fastlane
79
79
  target = project.targets[0] if target.nil?
80
80
  end
81
81
 
82
- target.build_configurations.each do |config|
82
+ if params[:build_configuration_name]
83
+ config = target.build_configurations.detect { |c| c.name == params[:build_configuration_name]}
83
84
  UI.message "updating #{config.name} to version #{next_version_number}"
84
85
  config.build_settings["MARKETING_VERSION"] = next_version_number
85
- end unless target.nil?
86
+ else
87
+ target.build_configurations.each do |config|
88
+ UI.message "updating #{config.name} to version #{next_version_number}"
89
+ config.build_settings["MARKETING_VERSION"] = next_version_number
90
+ end unless target.nil?
91
+ end
92
+
86
93
 
87
94
  project.save
88
95
  end
@@ -159,6 +166,10 @@ module Fastlane
159
166
  UI.user_error!("Available values are 'xcodeproj' and 'appstore'") unless ['xcodeproj', 'appstore'].include? value
160
167
  end,
161
168
  description: "Source version to increment. Available options: xcodeproj, appstore"),
169
+ FastlaneCore::ConfigItem.new(key: :country,
170
+ optional: true,
171
+ description: "Pass an optional country code, if your app's availability is limited to specific countries",
172
+ is_string: true),
162
173
  FastlaneCore::ConfigItem.new(key: :plist_build_setting_support,
163
174
  description: "support automatic resolution of build setting from xcodeproj if not a literal value in the plist",
164
175
  is_string: false,
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Versioning
3
- VERSION = "0.4.5"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siarhei Fiedartsou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-02 00:00:00.000000000 Z
12
+ date: 2022-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry