Skip to content

Commit

Permalink
fix(ci): update android ver bump
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ghorbani committed Nov 26, 2024
1 parent 598fa3c commit b7c461d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'

# Fastlane
gem "fastlane"
gem "fastlane-plugin-versioning"
gem "fastlane-plugin-versioning"
gem 'fastlane-plugin-versioning_android'
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ GEM
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
fastlane-plugin-versioning (0.7.0)
fastlane-plugin-versioning_android (0.1.1)
fastlane-sirp (1.0.0)
sysrandom (~> 1.0)
ffi (1.16.3)
Expand Down Expand Up @@ -283,6 +284,7 @@ DEPENDENCIES
cocoapods (>= 1.13, < 1.15)
fastlane
fastlane-plugin-versioning
fastlane-plugin-versioning_android

RUBY VERSION
ruby 3.2.3p157
Expand Down
28 changes: 11 additions & 17 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
desc "Bump version for Android"
lane :bump_version_android do |options|
# Debugging statements
sh("echo 'Current directory: ' $(pwd)")
sh("ls -la")

version_type = options[:version_type] || "patch"
root_dir = File.expand_path('..', Dir.pwd)

# More debugging
UI.message("Root directory: #{root_dir}")
sh("echo 'Root directory contents:'")
sh("ls -la #{root_dir}")

package_json_path = File.join(root_dir, 'package.json')
version_file_path = File.join(root_dir, '.version')

Expand All @@ -24,17 +15,20 @@ lane :bump_version_android do |options|

# Bump Android version
gradle_file = File.join(root_dir, "android/app/build.gradle")
android_version_code = get_version_code_from_gradle(gradle_file: gradle_file).to_i + 1

update_gradle_property(
property: "versionCode",
value: android_version_code.to_s,
# Get current version code and increment it
current_version_code = android_get_version_code(
gradle_file: gradle_file
)
update_gradle_property(
property: "versionName",
value: "\"#{new_version}\"",
gradle_file: gradle_file

android_set_version_code(
gradle_file: gradle_file,
version_code: current_version_code + 1
)

android_set_version_name(
gradle_file: gradle_file,
version_name: new_version
)

UI.message("Bumped Android version to #{new_version}")
Expand Down

0 comments on commit b7c461d

Please sign in to comment.