Clean up builds

This commit is contained in:
Zhiyuan Zheng 2022-06-11 20:26:40 +02:00
parent bf021cd02f
commit e66074ea70
2 changed files with 66 additions and 125 deletions

View File

@ -74,13 +74,6 @@ jobs:
ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }} ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}
SUPPLY_JSON_KEY_DATA: ${{ secrets.SUPPLY_JSON_KEY_DATA }} SUPPLY_JSON_KEY_DATA: ${{ secrets.SUPPLY_JSON_KEY_DATA }}
run: yarn app:build android run: yarn app:build android
- name: -- Step 7 -- Upload apk
uses: actions/upload-artifact@v3
with:
name: apk
path: ./tooot.apk
if-no-files-found: warn
retention-days: 7
create-release: create-release:
runs-on: macos-12 runs-on: macos-12
@ -105,11 +98,7 @@ jobs:
run: yarn install run: yarn install
- name: -- Step 5 -- Install ruby dependencies - name: -- Step 5 -- Install ruby dependencies
run: bundle install run: bundle install
- name: -- Step 6 -- Download apk - name: -- Step 6 -- Run fastlane
uses: actions/download-artifact@v3
with:
name: apk
- name: -- Step 7 -- Run fastlane
env: env:
ENVIRONMENT: ${{ steps.branch.outputs.branch }} ENVIRONMENT: ${{ steps.branch.outputs.branch }}
LC_ALL: en_US.UTF-8 LC_ALL: en_US.UTF-8

View File

@ -19,24 +19,6 @@ XCODEPROJ = "./ios/tooot.xcodeproj"
INFO_PLIST = "./ios/tooot/Info.plist" INFO_PLIST = "./ios/tooot/Info.plist"
EXPO_PLIST = "./ios/tooot/Supporting/Expo.plist" EXPO_PLIST = "./ios/tooot/Supporting/Expo.plist"
desc "IOS: Prepare app store"
private_lane :prepare_appstore_ios do
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
end
desc 'IOS: Update expo information'
private_lane :update_expo_ios do
set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesSDKVersion", value: VERSIONS[:expo] )
set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesReleaseChannel", value: RELEASE_CHANNEL )
end
desc "ANDROID: Prepare play store" desc "ANDROID: Prepare play store"
private_lane :prepare_playstore_android do private_lane :prepare_playstore_android do
android_set_version_name( version_name: VERSION, gradle_file: "./android/app/build.gradle" ) android_set_version_name( version_name: VERSION, gradle_file: "./android/app/build.gradle" )
@ -49,19 +31,29 @@ private_lane :build_ios do
IPA_FILE = "#{BUILD_DIRECTORY}/tooot.ipa" IPA_FILE = "#{BUILD_DIRECTORY}/tooot.ipa"
DSYM_FILE = "#{BUILD_DIRECTORY}/tooot.app.dSYM.zip" DSYM_FILE = "#{BUILD_DIRECTORY}/tooot.app.dSYM.zip"
update_expo_ios set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesSDKVersion", value: VERSIONS[:expo] )
set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesReleaseChannel", value: RELEASE_CHANNEL )
setup_ci setup_ci
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
)
case ENVIRONMENT case ENVIRONMENT
when "candidate" when "candidate"
prepare_appstore_ios
match( type: "appstore", readonly: true )
build_ios_app(
export_method: "app-store",
include_symbols: true,
output_directory: BUILD_DIRECTORY,
silent: true
)
sentry_upload_dsym( sentry_upload_dsym(
org_slug: ENV["SENTRY_ORGANIZATION"], org_slug: ENV["SENTRY_ORGANIZATION"],
project_slug: ENV["SENTRY_PROJECT"], project_slug: ENV["SENTRY_PROJECT"],
@ -76,26 +68,19 @@ private_lane :build_ios do
changelog: "感谢帮忙测试 tooot 🙏" changelog: "感谢帮忙测试 tooot 🙏"
) )
when "release" when "release"
prepare_appstore_ios upload_to_app_store(
match( type: "appstore", readonly: true ) ipa: IPA_FILE,
build_ios_app( app_version: VERSION
export_method: "app-store", )
include_bitcode: true, download_dsyms(
output_directory: BUILD_DIRECTORY, version: VERSION,
silent: true build_number: BUILD_NUMBER,
wait_for_dsym_processing: true
) )
upload_to_app_store( ipa: IPA_FILE, app_version: VERSION )
download_dsyms( version: VERSION, build_number: BUILD_NUMBER, wait_for_dsym_processing: true )
sentry_upload_dsym( sentry_upload_dsym(
org_slug: ENV["SENTRY_ORGANIZATION"], org_slug: ENV["SENTRY_ORGANIZATION"],
project_slug: ENV["SENTRY_PROJECT"], project_slug: ENV["SENTRY_PROJECT"],
) )
else
if !is_ci
match( type: "adhoc", readonly: true )
build_ios_app( export_method: "ad-hoc", output_directory: BUILD_DIRECTORY, silent: true )
install_on_device( skip_wifi: true )
end
end end
end end
@ -103,24 +88,26 @@ desc "Build and deploy Android app"
private_lane :build_android do private_lane :build_android do
sh("echo #{ENV["ANDROID_KEYSTORE"]} | base64 -d | tee #{File.expand_path('..', Dir.pwd)}/android/tooot.jks >/dev/null", log: false) sh("echo #{ENV["ANDROID_KEYSTORE"]} | base64 -d | tee #{File.expand_path('..', Dir.pwd)}/android/tooot.jks >/dev/null", log: false)
prepare_playstore_android
build_android_app(
task: 'clean bundle',
build_type: 'release',
project_dir: "./android",
print_command: true,
print_command_output: true,
properties: {
"expoSDK" => VERSIONS[:expo],
"releaseChannel" => RELEASE_CHANNEL,
"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"],
}
)
case ENVIRONMENT case ENVIRONMENT
when "candidate" when "candidate"
prepare_playstore_android
build_android_app(
task: 'clean bundle',
build_type: 'release',
project_dir: "./android",
print_command: true,
print_command_output: true,
properties: {
"expoSDK" => VERSIONS[:expo],
"releaseChannel" => RELEASE_CHANNEL,
"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"],
}
)
upload_to_play_store( upload_to_play_store(
track: "alpha", track: "alpha",
skip_upload_metadata: true, skip_upload_metadata: true,
@ -129,22 +116,6 @@ private_lane :build_android do
skip_upload_screenshots: true skip_upload_screenshots: true
) )
when "release" when "release"
prepare_playstore_android
build_android_app(
task: 'clean bundle',
build_type: 'release',
project_dir: "./android",
print_command: true,
print_command_output: true,
properties: {
"expoSDK" => VERSIONS[:expo],
"releaseChannel" => RELEASE_CHANNEL,
"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"],
}
)
upload_to_play_store( upload_to_play_store(
track: "production", track: "production",
skip_upload_changelogs: true skip_upload_changelogs: true
@ -156,44 +127,25 @@ desc "Build Android apk"
private_lane :build_android_apk do 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) sh("echo #{ENV["ANDROID_KEYSTORE"]} | base64 -d | tee #{File.expand_path('..', Dir.pwd)}/android/tooot.jks >/dev/null", log: false)
case ENVIRONMENT prepare_playstore_android
when "candidate"
prepare_playstore_android build_android_app(
build_android_app( task: 'assemble',
task: 'assemble', build_type: 'release',
build_type: 'release', project_dir: "./android",
project_dir: "./android", print_command: true,
print_command: false, print_command_output: true,
print_command_output: false, properties: {
properties: { "expoSDK" => VERSIONS[:expo],
"expoSDK" => VERSIONS[:expo], "releaseChannel" => RELEASE_CHANNEL,
"releaseChannel" => RELEASE_CHANNEL, "android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks",
"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.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"], "android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"],
"android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"], "android.injected.signing.key.password" => ENV["ANDROID_KEYSTORE_KEY_PASSWORD"],
"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.apk" sh "mv #{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]} #{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"
when "release"
prepare_playstore_android
build_android_app(
task: 'assemble',
build_type: 'release',
project_dir: "./android",
print_command: true,
print_command_output: true,
properties: {
"expoSDK" => VERSIONS[:expo],
"releaseChannel" => RELEASE_CHANNEL,
"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.apk"
end
end end
lane :ios do lane :ios do
@ -230,7 +182,7 @@ lane :release do
description: "No changelog provided", description: "No changelog provided",
commitish: git_branch, commitish: git_branch,
is_prerelease: ENVIRONMENT == 'candidate', is_prerelease: ENVIRONMENT == 'candidate',
upload_assets: ["#{File.expand_path('..', Dir.pwd)}/tooot.apk"] upload_assets: ["#{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"]
) )
end end
yarn( package_path: "./package.json", flags: "release", command: RELEASE_CHANNEL ) yarn( package_path: "./package.json", flags: "release", command: RELEASE_CHANNEL )