Skip to content

Commit 598fa3c

Browse files
committed
fix(ci): fix bump version issue
1 parent 2a7e973 commit 598fa3c

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858

5959
# Step 5: Bump Android version
6060
- name: Bump Android version
61+
working-directory: ${{ github.workspace }}
6162
run: bundle exec fastlane bump_version_android version_type:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type || 'patch' }}
6263

6364
# Step 6: Commit and push Android version changes
@@ -145,6 +146,7 @@ jobs:
145146

146147
# Step 6: Bump iOS version
147148
- name: Bump iOS version
149+
working-directory: ${{ github.workspace }}
148150
run: bundle exec fastlane bump_version_ios
149151

150152
# Step 7: Commit, push, and tag iOS version changes

fastlane/Fastfile

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
desc "Bump version for Android"
22
lane :bump_version_android do |options|
3+
# Debugging statements
4+
sh("echo 'Current directory: ' $(pwd)")
5+
sh("ls -la")
6+
37
version_type = options[:version_type] || "patch"
8+
root_dir = File.expand_path('..', Dir.pwd)
9+
10+
# More debugging
11+
UI.message("Root directory: #{root_dir}")
12+
sh("echo 'Root directory contents:'")
13+
sh("ls -la #{root_dir}")
414

5-
# Bump version in package.json using Yarn
6-
sh("yarn version --#{version_type} --no-git-tag-version")
7-
new_version = JSON.parse(File.read('package.json'))['version']
8-
sh("echo #{new_version} > .version")
15+
package_json_path = File.join(root_dir, 'package.json')
16+
version_file_path = File.join(root_dir, '.version')
17+
18+
Dir.chdir(root_dir) do
19+
sh("yarn version --#{version_type} --no-git-tag-version")
20+
end
21+
22+
new_version = JSON.parse(File.read(package_json_path))['version']
23+
sh("echo #{new_version} > #{version_file_path}")
924

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

1429
update_gradle_property(
@@ -27,8 +42,21 @@ end
2742

2843
desc "Bump version for iOS"
2944
lane :bump_version_ios do |options|
45+
# Debugging statements
46+
sh("echo 'Current directory: ' $(pwd)")
47+
sh("ls -la")
48+
49+
root_dir = File.expand_path('..', Dir.pwd)
50+
51+
# More debugging
52+
UI.message("Root directory: #{root_dir}")
53+
sh("echo 'Root directory contents:'")
54+
sh("ls -la #{root_dir}")
55+
56+
package_json_path = File.join(root_dir, 'package.json')
57+
3058
# Read the version from package.json
31-
new_version = JSON.parse(File.read('package.json'))['version']
59+
new_version = JSON.parse(File.read(package_json_path))['version']
3260

3361
# Bump iOS version
3462
increment_version_number(version_number: new_version)

0 commit comments

Comments
 (0)