Skip to content

Commit

Permalink
chore(ci): fix version code bump
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ghorbani committed Nov 27, 2024
1 parent 5ba8fb8 commit 9002685
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ android {
applicationId "com.pocketpalai"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 202411271956
versionCode 15
versionName "1.5.4"
ndk {
abiFilters "arm64-v8a", "x86_64"
Expand Down
19 changes: 11 additions & 8 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,36 @@ lane :bump_version do |options|
new_version = JSON.parse(File.read(package_json_path))['version']
sh("echo #{new_version} > #{version_file_path}")

# Generate common build number based on timestamp
build_number = Time.now.strftime("%Y%m%d%H%M")

# Bump Android version
# For Android: Read current version code and increment it
gradle_file = File.join(root_dir, "android/app/build.gradle")
current_version_code = android_get_version_code(gradle_file: gradle_file).to_i
new_version_code = current_version_code + 1

# Update Android version
android_set_version_code(
gradle_file: gradle_file,
version_code: build_number
version_code: new_version_code
)

android_set_version_name(
gradle_file: gradle_file,
version_name: new_version
)

# Bump iOS version
# For iOS: Bump version and build number
ios_dir = File.join(root_dir, 'ios')
Dir.chdir(ios_dir) do
increment_version_number_in_xcodeproj(
version_number: new_version,
xcodeproj: File.join(ios_dir, "PocketPal.xcodeproj")
)
increment_build_number_in_xcodeproj(
build_number: build_number,
xcodeproj: File.join(ios_dir, "PocketPal.xcodeproj")
)
end

UI.message("Bumped Android and iOS versions to #{new_version}")
UI.message("Bumped versions:")
UI.message("- Version name: #{new_version}")
UI.message("- Android version code: #{new_version_code}")
UI.message("- iOS build number: #{get_build_number_from_xcodeproj(xcodeproj: File.join(ios_dir, 'PocketPal.xcodeproj'))}")
end
8 changes: 4 additions & 4 deletions ios/PocketPal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
baseConfigurationReference = 12009917F81D5194B51E7253 /* Pods-PocketPal-PocketPalTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 202411271956;
CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = MYXGXY23Y6;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -456,7 +456,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 202411271956;
CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = MYXGXY23Y6;
INFOPLIST_FILE = PocketPalTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
Expand All @@ -483,7 +483,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 202411271956;
CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = MYXGXY23Y6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = PocketPal/Info.plist;
Expand Down Expand Up @@ -525,7 +525,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 202411271956;
CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = MYXGXY23Y6;
INFOPLIST_FILE = PocketPal/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand Down

0 comments on commit 9002685

Please sign in to comment.