Skip to content

[#225] 테스트플라이트 자동 배포가 실패하는 현상을 해결한다#239

Merged
opficdev merged 19 commits intodevelopfrom
fix/#225-fastlane
Mar 10, 2026
Merged

[#225] 테스트플라이트 자동 배포가 실패하는 현상을 해결한다#239
opficdev merged 19 commits intodevelopfrom
fix/#225-fastlane

Conversation

@opficdev
Copy link
Owner

@opficdev opficdev self-assigned this Mar 10, 2026
@opficdev opficdev merged commit c6999f2 into develop Mar 10, 2026
1 check failed
@opficdev opficdev deleted the fix/#225-fastlane branch March 10, 2026 01:56
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 Pull Request는 TestFlight 자동 배포 실패 문제를 해결합니다. 기존의 빌드 번호 증가 로직을 개선하여 App Store Connect에서 최신 TestFlight 빌드 번호를 가져와 올바르게 증가시키는 새로운 방식을 도입했습니다. 또한, CI 환경에서 코드 서명 설정을 명시적으로 구성하고 개발 프로비저닝 프로파일을 포함하여 CI/CD 파이프라인의 안정성과 배포 성공률을 높였습니다.

Highlights

  • TestFlight Build Number Logic: Implemented a new mechanism to fetch the latest TestFlight build number from App Store Connect and increment it, resolving potential conflicts or failures with sequential build numbers during automated deployments.
  • CI/CD Robustness: Enhanced Fastlane configuration for CI environments by explicitly setting code signing parameters and including development provisioning profiles, improving the reliability of automated builds and deployments.
  • Fastlane Refactoring and Clarity: Introduced constants for project and target names to centralize configuration, and renamed the 'beta' lane to 'deploy_testflight' for improved clarity and consistency.
Changelog
  • .gitignore
    • Added fastlane/README.md to the ignored files.
  • fastlane/Fastfile
    • Defined XCODE_PROJ, APP_IDENTIFIER, and TARGET_NAME constants for better configuration management.
    • Implemented a new private lane fetch_latest_testflight_build_number to retrieve the highest build number for a given version from App Store Connect.
    • Modified the build_for_store private lane to utilize the new build number fetching logic, ensuring sequential TestFlight build numbers.
    • Added default environment variable settings for FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT and FASTLANE_XCODEBUILD_SETTINGS_RETRIES.
    • Included match(type: "development") to ensure development provisioning profiles are handled.
    • Introduced explicit update_code_signing_settings for CI environments to manage provisioning profiles and code signing identities.
    • Updated build_app to use the newly defined constants and added xcargs: "-skipPackagePluginValidation".
    • Renamed the beta lane to deploy_testflight for improved semantic clarity.
    • Added a new lane testflight_build_only which simply calls build_for_store.
Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/build.yml
    • .github/workflows/release.yml
    • .github/workflows/testflight.yml
Activity
  • The pull request was created by opficdev.
  • The pull request description includes a commit hash (064633c) for reference.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

테스트플라이트 자동 배포 실패 문제를 해결하기 위한 변경 사항들을 확인했습니다. App Store Connect API를 통해 마지막 빌드 번호를 가져와서 증분시키는 방식으로 기존의 GITHUB_RUN_NUMBER를 사용하던 방식의 문제를 해결한 점이 좋습니다. 전반적으로 올바른 수정 방향이라고 생각합니다. 코드 가독성과 유지보수성을 높이기 위해 몇 가지 스타일 관련 제안을 드립니다.

Comment on lines +11 to +23
apiKey = options[:api_key]
versionNumber = options[:version]

Spaceship::ConnectAPI.token = Spaceship::ConnectAPI::Token.create(**apiKey)

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")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Ruby에서는 변수명에 스네이크 케이스(snake_case)를 사용하는 것이 일반적인 컨벤션입니다. apiKeyversionNumber를 각각 api_keyversion_number로 변경하는 것을 제안합니다. 이렇게 하면 코드의 일관성과 가독성이 향상됩니다.

    api_key = options[:api_key]
    version_number = options[:version]

    Spaceship::ConnectAPI.token = Spaceship::ConnectAPI::Token.create(**api_key)

    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" => version_number,
      "platform" => Spaceship::ConnectAPI::Platform.map("ios")
    }

Comment on lines +47 to +53
if ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"].to_s.strip.empty?
ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "30"
end

if ENV["FASTLANE_XCODEBUILD_SETTINGS_RETRIES"].to_s.strip.empty?
ENV["FASTLANE_XCODEBUILD_SETTINGS_RETRIES"] = "5"
end
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

if 블록들은 후행 if문을 사용하여 각각 한 줄로 더 간결하게 표현할 수 있습니다.

    ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "30" if ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"].to_s.strip.empty?

    ENV["FASTLANE_XCODEBUILD_SETTINGS_RETRIES"] = "5" if ENV["FASTLANE_XCODEBUILD_SETTINGS_RETRIES"].to_s.strip.empty?

Comment on lines +57 to +72
versionNumber = get_version_number(
xcodeproj: XCODE_PROJ,
target: TARGET_NAME
)

latestTestflightBuildNumber = fetch_latest_testflight_build_number(
api_key: api_key,
version: versionNumber
)

setup_ci if ENV["CI"]

if ENV["GITHUB_RUN_NUMBER"]
increment_build_number(
xcodeproj: "DevLog.xcodeproj",
build_number: ENV["GITHUB_RUN_NUMBER"]
)
end
increment_build_number(
xcodeproj: XCODE_PROJ,
build_number: latestTestflightBuildNumber + 1
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Ruby 컨벤션에 따라 변수명에 스네이크 케이스(snake_case)를 사용하는 것이 좋습니다. versionNumberlatestTestflightBuildNumber를 각각 version_numberlatest_testflight_build_number로 변경하는 것을 제안합니다.

    version_number = get_version_number(
      xcodeproj: XCODE_PROJ,
      target: TARGET_NAME
    )

    latest_testflight_build_number = fetch_latest_testflight_build_number(
      api_key: api_key,
      version: version_number
    )

    setup_ci if ENV["CI"]

    increment_build_number(
      xcodeproj: XCODE_PROJ,
      build_number: latest_testflight_build_number + 1
    )

Comment on lines +87 to +99
provisioningProfileSpecifier = lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING][APP_IDENTIFIER].to_s
UI.user_error!("Missing App Store provisioning profile mapping for #{APP_IDENTIFIER}") if provisioningProfileSpecifier.empty?

update_code_signing_settings(
use_automatic_signing: false,
path: XCODE_PROJ,
sdk: "iphoneos*",
team_id: ENV["APP_STORE_TEAM_ID"],
targets: [TARGET_NAME],
build_configurations: ["Release"],
code_sign_identity: "Apple Distribution",
profile_name: provisioningProfileSpecifier
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Ruby 컨벤션에 따라 변수명에 스네이크 케이스(snake_case)를 사용하는 것이 좋습니다. provisioningProfileSpecifierprovisioning_profile_specifier로 변경하는 것을 제안합니다.

      provisioning_profile_specifier = lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING][APP_IDENTIFIER].to_s
      UI.user_error!("Missing App Store provisioning profile mapping for #{APP_IDENTIFIER}") if provisioning_profile_specifier.empty?

      update_code_signing_settings(
        use_automatic_signing: false,
        path: XCODE_PROJ,
        sdk: "iphoneos*",
        team_id: ENV["APP_STORE_TEAM_ID"],
        targets: [TARGET_NAME],
        build_configurations: ["Release"],
        code_sign_identity: "Apple Distribution",
        profile_name: provisioning_profile_specifier
      )

Comment on lines +121 to +123
lane :testflight_build_only do
build_for_store
end
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

testflight_build_only라는 lane 이름이 약간 혼동을 줄 수 있습니다. 이 lane은 build_for_store를 호출하여 스토어용 빌드를 생성하지만, TestFlight에 업로드하는 과정은 포함하지 않습니다. 이름이 하는 역할과 다른 인상을 줄 수 있습니다. 예를 들어 build_for_distribution 또는 build_only와 같이 역할을 더 명확하게 나타내는 이름으로 변경하는 것을 고려해볼 수 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant