62 lines
1.6 KiB
Ruby
62 lines
1.6 KiB
Ruby
# This file contains the fastlane.tools configuration
|
|
# You can find the documentation at https://docs.fastlane.tools
|
|
#
|
|
# For a list of all available actions, check out
|
|
#
|
|
# https://docs.fastlane.tools/actions
|
|
#
|
|
# For a list of all available plugins, check out
|
|
#
|
|
# https://docs.fastlane.tools/plugins/available-plugins
|
|
#
|
|
|
|
# Uncomment the line if you want fastlane to automatically update itself
|
|
# update_fastlane
|
|
|
|
default_platform(:android)
|
|
|
|
package = load_json(json_path: File.join(__dir__, 'package.json'))
|
|
version_number = package['version'] || '0.0.1'
|
|
# Generate version code by padding each component to 3 digits and joining them together
|
|
# Eg. 1.2.3 becomes 001002003 -> 1002003 as integer
|
|
version_code = version_number.split('.').map { |v| v.rjust(3, '0') }.join.to_i || 1
|
|
|
|
android_project_dir = File.join(__dir__, 'android')
|
|
|
|
platform :android do
|
|
desc 'Release a new version to Google Play'
|
|
lane :release do
|
|
gradle(
|
|
task: 'clean assembleRelease',
|
|
project_dir: android_project_dir,
|
|
properties: {
|
|
'versionName' => version_number,
|
|
'versionCode' => version_code
|
|
}
|
|
)
|
|
upload_to_play_store
|
|
end
|
|
end
|
|
|
|
ios_project_dir = File.join(__dir__, 'ios', 'App', 'App.xcodeproj')
|
|
|
|
platform :ios do
|
|
desc 'Release a new version to the App Store'
|
|
lane :release do
|
|
increment_version_number(
|
|
version_number: version_number,
|
|
xcodeproj: ios_project_dir
|
|
)
|
|
increment_build_number(
|
|
build_number: version_code,
|
|
xcodeproj: ios_project_dir
|
|
)
|
|
sync_code_signing(
|
|
type: 'appstore',
|
|
xcodeproj: ios_project_dir
|
|
)
|
|
build_app(xcodeproj: ios_project_dir)
|
|
upload_to_app_store
|
|
end
|
|
end
|