2021-02-03 23:49:18 +01:00
|
|
|
skip_docs
|
2021-01-31 03:09:35 +01:00
|
|
|
|
2022-09-21 00:16:55 +02:00
|
|
|
VERSION = read_json( json_path: "./package.json" )[:version]
|
|
|
|
GITHUB_RELEASE = "v#{VERSION}"
|
2021-03-14 21:48:28 +01:00
|
|
|
ENVIRONMENT = ENV["ENVIRONMENT"]
|
2021-03-18 09:50:14 +01:00
|
|
|
BUILD_NUMBER = "#{Time.now.strftime("%y%m%d")}#{ENV["GITHUB_RUN_NUMBER"]}"
|
2021-02-03 23:49:18 +01:00
|
|
|
GITHUB_REPO = "tooot-app/app"
|
2021-01-31 03:09:35 +01:00
|
|
|
|
2021-02-03 23:49:18 +01:00
|
|
|
XCODEPROJ = "./ios/tooot.xcodeproj"
|
|
|
|
INFO_PLIST = "./ios/tooot/Info.plist"
|
2021-01-31 03:09:35 +01:00
|
|
|
|
2021-02-05 01:13:57 +01:00
|
|
|
desc "ANDROID: Prepare play store"
|
|
|
|
private_lane :prepare_playstore_android do
|
|
|
|
android_set_version_name( version_name: VERSION, gradle_file: "./android/app/build.gradle" )
|
|
|
|
android_set_version_code( version_code: BUILD_NUMBER, gradle_file: "./android/app/build.gradle" )
|
|
|
|
end
|
|
|
|
|
2021-02-04 01:01:35 +01:00
|
|
|
desc "Build and deploy iOS app"
|
2021-02-03 23:49:18 +01:00
|
|
|
private_lane :build_ios do
|
|
|
|
BUILD_DIRECTORY = "./ios/build"
|
2021-04-03 11:52:13 +02:00
|
|
|
IPA_FILE = "#{BUILD_DIRECTORY}/tooot.ipa"
|
|
|
|
DSYM_FILE = "#{BUILD_DIRECTORY}/tooot.app.dSYM.zip"
|
2021-02-02 22:50:38 +01:00
|
|
|
|
2021-02-03 23:49:18 +01:00
|
|
|
setup_ci
|
2022-06-11 20:26:40 +02:00
|
|
|
set_info_plist_value( path: INFO_PLIST, key: "CFBundleShortVersionString", value: VERSION )
|
|
|
|
set_info_plist_value(
|
|
|
|
path: INFO_PLIST,
|
|
|
|
key: "NSAppTransportSecurity",
|
|
|
|
value: {}
|
|
|
|
)
|
|
|
|
increment_build_number( xcodeproj: XCODEPROJ, build_number: BUILD_NUMBER )
|
|
|
|
app_store_connect_api_key
|
|
|
|
match( type: "appstore", readonly: true )
|
|
|
|
|
|
|
|
build_ios_app(
|
|
|
|
export_method: "app-store",
|
|
|
|
include_symbols: true,
|
|
|
|
output_directory: BUILD_DIRECTORY,
|
|
|
|
silent: false
|
|
|
|
)
|
2021-01-31 03:09:35 +01:00
|
|
|
|
2021-02-03 23:49:18 +01:00
|
|
|
case ENVIRONMENT
|
2021-03-14 21:48:28 +01:00
|
|
|
when "candidate"
|
2021-04-03 11:52:13 +02:00
|
|
|
sentry_upload_dsym(
|
|
|
|
org_slug: ENV["SENTRY_ORGANIZATION"],
|
|
|
|
project_slug: ENV["SENTRY_PROJECT"],
|
|
|
|
dsym_path: DSYM_FILE
|
|
|
|
)
|
2021-02-03 23:49:18 +01:00
|
|
|
upload_to_testflight(
|
2021-10-25 23:41:10 +02:00
|
|
|
skip_submission: true,
|
2021-04-03 11:52:13 +02:00
|
|
|
ipa: IPA_FILE,
|
2021-02-03 23:49:18 +01:00
|
|
|
demo_account_required: true,
|
|
|
|
distribute_external: true,
|
2021-04-11 19:56:48 +02:00
|
|
|
groups: "尝鲜",
|
2021-10-25 23:41:10 +02:00
|
|
|
changelog: "感谢帮忙测试 tooot 🙏"
|
2021-02-03 23:49:18 +01:00
|
|
|
)
|
2021-03-14 21:48:28 +01:00
|
|
|
when "release"
|
2022-06-11 20:26:40 +02:00
|
|
|
upload_to_app_store(
|
|
|
|
ipa: IPA_FILE,
|
|
|
|
app_version: VERSION
|
|
|
|
)
|
|
|
|
download_dsyms(
|
|
|
|
version: VERSION,
|
|
|
|
build_number: BUILD_NUMBER,
|
|
|
|
wait_for_dsym_processing: true
|
2021-04-03 11:52:13 +02:00
|
|
|
)
|
2022-01-03 20:20:54 +01:00
|
|
|
sentry_upload_dsym(
|
|
|
|
org_slug: ENV["SENTRY_ORGANIZATION"],
|
|
|
|
project_slug: ENV["SENTRY_PROJECT"],
|
|
|
|
)
|
2021-01-31 03:09:35 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-04 01:17:54 +01:00
|
|
|
desc "Build and deploy Android app"
|
|
|
|
private_lane :build_android do
|
2021-02-05 01:13:57 +01:00
|
|
|
sh("echo #{ENV["ANDROID_KEYSTORE"]} | base64 -d | tee #{File.expand_path('..', Dir.pwd)}/android/tooot.jks >/dev/null", log: false)
|
|
|
|
|
2022-06-11 20:26:40 +02:00
|
|
|
prepare_playstore_android
|
|
|
|
|
|
|
|
build_android_app(
|
|
|
|
task: 'clean bundle',
|
|
|
|
build_type: 'release',
|
|
|
|
project_dir: "./android",
|
|
|
|
print_command: true,
|
|
|
|
print_command_output: true,
|
|
|
|
properties: {
|
|
|
|
"android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks",
|
|
|
|
"android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"],
|
|
|
|
"android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"],
|
|
|
|
"android.injected.signing.key.password" => ENV["ANDROID_KEYSTORE_KEY_PASSWORD"],
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2021-02-04 01:17:54 +01:00
|
|
|
case ENVIRONMENT
|
2021-03-14 21:48:28 +01:00
|
|
|
when "candidate"
|
2021-02-05 01:13:57 +01:00
|
|
|
upload_to_play_store(
|
2021-04-11 19:56:48 +02:00
|
|
|
track: "alpha",
|
2021-02-05 01:13:57 +01:00
|
|
|
skip_upload_metadata: true,
|
|
|
|
skip_upload_changelogs: true,
|
|
|
|
skip_upload_images: true,
|
|
|
|
skip_upload_screenshots: true
|
2021-02-04 01:17:54 +01:00
|
|
|
)
|
2022-06-11 19:56:26 +02:00
|
|
|
when "release"
|
|
|
|
upload_to_play_store(
|
|
|
|
track: "production",
|
|
|
|
skip_upload_changelogs: true
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Build Android apk"
|
|
|
|
private_lane :build_android_apk do
|
|
|
|
sh("echo #{ENV["ANDROID_KEYSTORE"]} | base64 -d | tee #{File.expand_path('..', Dir.pwd)}/android/tooot.jks >/dev/null", log: false)
|
|
|
|
|
2022-06-11 20:26:40 +02:00
|
|
|
prepare_playstore_android
|
|
|
|
|
|
|
|
build_android_app(
|
|
|
|
task: 'assemble',
|
|
|
|
build_type: 'release',
|
|
|
|
project_dir: "./android",
|
|
|
|
print_command: true,
|
|
|
|
print_command_output: true,
|
|
|
|
properties: {
|
|
|
|
"android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks",
|
|
|
|
"android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"],
|
|
|
|
"android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"],
|
|
|
|
"android.injected.signing.key.password" => ENV["ANDROID_KEYSTORE_KEY_PASSWORD"],
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
sh "mv #{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]} #{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"
|
2021-02-04 01:17:54 +01:00
|
|
|
end
|
|
|
|
|
2022-06-10 23:39:57 +02:00
|
|
|
lane :ios do
|
2022-09-21 00:16:55 +02:00
|
|
|
cocoapods(clean_install: true, podfile: "./ios/Podfile")
|
|
|
|
build_ios
|
2022-06-10 23:39:57 +02:00
|
|
|
rocket
|
|
|
|
end
|
|
|
|
|
|
|
|
lane :android do
|
2022-09-21 00:16:55 +02:00
|
|
|
build_android
|
2022-06-10 23:39:57 +02:00
|
|
|
rocket
|
|
|
|
end
|
|
|
|
|
|
|
|
lane :release do
|
2022-09-21 21:55:58 +02:00
|
|
|
if ENVIRONMENT == 'release'
|
|
|
|
build_android_apk
|
|
|
|
set_github_release(
|
|
|
|
repository_name: GITHUB_REPO,
|
|
|
|
name: GITHUB_RELEASE,
|
|
|
|
tag_name: GITHUB_RELEASE,
|
|
|
|
description: "No changelog provided",
|
|
|
|
commitish: git_branch,
|
|
|
|
is_prerelease: false,
|
|
|
|
upload_assets: ["#{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"]
|
|
|
|
)
|
|
|
|
end
|
2021-02-03 23:49:18 +01:00
|
|
|
rocket
|
2022-02-10 10:12:47 +01:00
|
|
|
end
|