Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ _None_

### New Features

- Add `ios_get_build_number` action to get the current build number from an `xcconfig` file. [#458]

_None_

### Bug Fixes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module Fastlane
module Actions
class IosGetBuildNumberAction < Action
def self.run(params)
require_relative '../../helper/ios/ios_version_helper'

UI.user_error!('You need to set at least the PUBLIC_CONFIG_FILE env var to the path to the public xcconfig file') unless ENV['PUBLIC_CONFIG_FILE']

Fastlane::Helper::Ios::VersionHelper.get_build_number
end

#####################################################
# @!group Documentation
#####################################################

def self.description
'Gets the public build number of the app'
end

def self.details
'Gets the public build number of the app'
end

def self.available_options
# Define all options your action supports.
end

def self.output
# Define the shared values you are going to provide
end

def self.return_value
# If you method provides a return value, you can describe here what it does
'Return the public build number of the app'
end

def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
['Automattic']
end

def self.is_supported?(platform)
[:ios, :mac].include?(platform)
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ def self.get_internal_version
get_version_strings()[1]
end

# Returns the current value of the `BUILD_NUMBER` key from the public xcconfig file
#
# @return [String] The current build number according to the public xcconfig file.
#
def self.get_build_number
read_build_number_from_config_file(ENV['PUBLIC_CONFIG_FILE'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered passing the file as an argument?

See discussion in #380 and the work done in #445.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mokagio Ready for re-review. It now uses an argument instead of the env variable

end

# Prints the current and next release version numbers to stdout, then return the next release version
#
# @return [String] The next release version to use after bumping the currently used public version.
Expand Down