Add ios_get_build_number action#458
Merged
Merged
Conversation
mokagio
reviewed
Mar 28, 2023
| # @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']) |
Contributor
Contributor
Author
There was a problem hiding this comment.
@mokagio Ready for re-review. It now uses an argument instead of the env variable
wpmobilebot
reviewed
Apr 20, 2023
wpmobilebot
reviewed
Apr 26, 2023
mokagio
approved these changes
Apr 27, 2023
Comment on lines
+16
to
+24
| it 'parses an xcconfig file with keys with spaces and returns a nil build number' do | ||
| xcconfig_mock_content = <<~CONTENT | ||
| VERSION_SHORT = 6 | ||
| VERSION_LONG = 6.30.1 | ||
| BUILD_NUMBER = 1940 | ||
| CONTENT | ||
|
|
||
| expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: nil) | ||
| end |
Contributor
There was a problem hiding this comment.
I was surprised by this because key = value is a valid xcconfig syntax. Looking at the pre-existing, underlying implementation, I can see why this is required given that we manually parse the xcconfig files
We should be able to replace that bespoke logic with the API provided by the xcodeproj gem like we do in Jetpack and WordPress iOS:
version_config_path = File.join(PROJECT_ROOT_FOLDER, 'config', 'Version.internal.xcconfig')
versions = Xcodeproj::Config.new(File.new(version_config_path)).to_hash
Contributor
Author
Co-authored-by: Gio Lodi <gio.lodi@automattic.com>
Co-authored-by: Gio Lodi <gio.lodi@automattic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does it do?
This action adds an action called
ios_get_build_numberto get the current build number from anxcconfigfile. Because Day One iOS and Mac use the build number to name builds, this new action is needed for things like GitHub release names and tags.How to test
bloom/DayOne-Applerepo, switch to thespencer/demo-get-build-number-actionbranchbundle exec fastlane ios test_get_build_number_actionbundle exec fastlane mac test_get_build_number_actionChecklist before requesting a review
bundle exec rubocopto test for code style violations and recommendationsspecs/*_spec.rb) if applicablebundle exec rspecto run the whole test suite and ensure all your tests passCHANGELOG.mdfile to describe your changes under the approprioate existing###subsection of the existing## Trunksection.