Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ TARGET_NAME = "DevLog"
default_platform(:ios)

platform :ios do
private_lane :fetch_latest_testflight_build_number do |options|
require "spaceship"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

성능 향상을 위해 require "spaceship" 구문을 파일 최상단으로 옮기는 것이 좋습니다. require는 lane 내부에서 호출될 때마다 실행되지만, 파일 상단에 있으면 Fastfile 로드 시 한 번만 실행됩니다. 이 줄을 삭제하고 파일 상단(예: 4번째 줄 다음)에 추가해주세요.


versionNumber = options[:version]

Spaceship::ConnectAPI.token = Spaceship::ConnectAPI::Token.create(
key_id: ENV["ASC_KEY_ID"],
issuer_id: ENV["ASC_ISSUER_ID"],
key: File.binread(ENV["ASC_KEY_PATH"]),
in_house: false
)
Comment on lines +13 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

build_for_store lane에서 이 lane을 호출하기 전에 이미 asc_api_key lane을 통해 App Store Connect API 토큰이 설정됩니다. 따라서 여기서 토큰을 다시 생성하는 것은 중복입니다. 이 코드 블록을 제거하여 중복을 피하고 asc_api_key lane을 통해 인증을 일관되게 관리하는 것이 좋습니다.


app = Spaceship::ConnectAPI::App.find(APP_IDENTIFIER)
UI.user_error!("Could not find app for #{APP_IDENTIFIER}") if app.nil?

filter = {
"state" => "PROCESSING,FAILED,COMPLETE",
"cfBundleShortVersionString" => versionNumber,
"platform" => Spaceship::ConnectAPI::Platform.map("ios")
}

build = Spaceship::ConnectAPI.get_build_uploads(
app_id: app.id,
filter: filter,
sort: "-uploadedDate",
limit: 1
).first

next 0 if build.nil?

next build.cf_build_version.to_i
end

private_lane :asc_api_key do
app_store_connect_api_key(
key_id: ENV["ASC_KEY_ID"],
Expand All @@ -30,11 +63,8 @@ platform :ios do
target: TARGET_NAME
)

latestTestflightBuildNumber = app_store_build_number(
live: false,
app_identifier: APP_IDENTIFIER,
version: versionNumber,
initial_build_number: 0
latestTestflightBuildNumber = fetch_latest_testflight_build_number(
version: versionNumber
)

setup_ci if ENV["CI"]
Expand Down
Loading