Skip to content

[#255] fastlane 배포 시 빌드 자동화를 우선 시행하도록 한다#256

Merged
opficdev merged 6 commits intodevelopfrom
fix/#255-fastlane
Mar 11, 2026
Merged

[#255] fastlane 배포 시 빌드 자동화를 우선 시행하도록 한다#256
opficdev merged 6 commits intodevelopfrom
fix/#255-fastlane

Conversation

@opficdev
Copy link
Copy Markdown
Owner

@opficdev opficdev self-assigned this Mar 11, 2026
@gemini-code-assist
Copy link
Copy Markdown
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!

이 PR은 Fastlane을 통한 iOS 앱 배포 프로세스의 빌드 자동화를 개선합니다. 새로운 GitHub Action을 도입하여 iOS 시뮬레이터 빌드를 표준화하고, Fastlane Fastfile을 업데이트하여 TestFlight 빌드 및 업로드 단계를 명확하게 분리하고 출력 경로를 지정합니다. 이는 빌드 프로세스의 안정성과 재현성을 향상시키는 데 기여합니다.

Highlights

  • iOS 시뮬레이터 빌드 자동화: 새로운 GitHub Action을 추가하여 iOS 시뮬레이터 빌드 프로세스를 자동화했습니다. 이 액션은 Xcode 버전에 맞는 최신 iOS 시뮬레이터와 iPhone 장치를 자동으로 선택하여 빌드를 수행합니다.
  • Fastlane TestFlight 배포 개선: Fastlane Fastfile을 업데이트하여 TestFlight 빌드 IPA 파일의 출력 경로를 명시적으로 정의하고, deploy_testflight 레인을 리팩토링하여 빌드와 업로드 단계를 분리했습니다.
  • 빌드 및 업로드 레인 분리: 새로운 upload_testflight_build 레인을 추가하여 빌드된 IPA 파일을 지정된 경로에서 찾아 TestFlight에 업로드하는 기능을 담당하도록 했습니다.
Changelog
  • .github/actions/ios-simulator-build/action.yml
    • iOS 시뮬레이터 빌드를 위한 GitHub Action이 추가되었습니다.
    • Xcode 버전에 맞는 최신 iOS 시뮬레이터와 iPhone 장치를 자동으로 선택하는 로직이 포함되었습니다.
    • xcodebuild를 사용하여 Swift Package 종속성을 해결하고 앱을 빌드합니다.
  • fastlane/Fastfile
    • TestFlight 빌드 IPA 파일의 출력 디렉토리와 이름을 정의하는 상수가 추가되었습니다.
    • build_for_store 레인에서 gym 액션의 출력 경로를 명시적으로 설정하도록 업데이트되었습니다.
    • deploy_testflight 레인이 build_for_store와 새로 추가된 upload_testflight_build 레인을 호출하도록 수정되었습니다.
    • 빌드된 IPA 파일을 지정된 경로에서 찾아 TestFlight에 업로드하는 upload_testflight_build 새 레인이 추가되었습니다.
Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/build.yml
    • .github/workflows/release.yml
    • .github/workflows/testflight.yml
Activity
  • opficdev님이 이슈 #255를 닫았습니다.
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
Copy Markdown
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

This pull request aims to prioritize build automation during fastlane distribution, separating build and upload steps to enhance CI/CD pipeline flexibility. However, a critical security concern has been identified: potential command injection vulnerabilities in the new GitHub Action due to the direct use of expressions in bash scripts. Additionally, the GitHub Action script has a flaw in its simulator selection logic, and the Fastfile duplicates API key generation, which could be improved. It is recommended to use environment variables to pass inputs and step outputs to shell scripts to prevent arbitrary command execution and address the other identified issues.

Comment on lines +18 to +47
# macOS 메인 버전에 맞는 iOS 버전 중 최신 버전의 iPhone 선택
RESULT=$(python3 - <<'PY'
import re, subprocess, sys

xcode_ver = subprocess.check_output(["xcodebuild", "-version"], text=True).splitlines()[0].strip()
xcode_major = xcode_ver.split()[1].split('.')[0]
try:
xcode_major_num = int(xcode_major)
except ValueError:
xcode_major_num = None
if xcode_major_num is not None and xcode_major_num <= 15:
xcode_major = "26"

text = subprocess.check_output(["xcrun", "simctl", "list", "devices"], text=True)
lines = text.splitlines()

def ver_key(v):
return tuple(int(x) for x in v.split('.'))

# 1) 최신 iOS 버전(해당 mac 메이저) 찾기
latest_ver = None
for line in lines:
header = re.match(r"^-- iOS ([0-9]+(?:\.[0-9]+)*) --$", line.strip())
if not header:
continue
ver = header.group(1)
if not ver.startswith(f"{xcode_major}."):
continue
if latest_ver is None or ver_key(ver) > ver_key(latest_ver):
latest_ver = ver
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

iOS 시뮬레이터 버전을 선택하는 Python 스크립트 로직에 문제가 있어, 의도와 다르게 동작하여 시뮬레이터를 찾지 못하고 실패할 수 있습니다.

  1. xcodebuild -version으로 얻은 Xcode 메이저 버전(예: 15)과 simctl이 목록으로 보여주는 iOS SDK 버전(예: 17.2)은 직접적인 숫자 연관성이 없습니다.
  2. xcode_major를 특정 조건에서 "26"으로 하드코딩하는 부분은 iOS 버전 규칙과 맞지 않아 원하는 결과를 얻기 어렵습니다.

xcrun simctl list devices는 현재 Xcode 환경에서 사용 가능한 시뮬레이터 목록을 보여주므로, 복잡한 버전 확인 없이 목록에서 가장 최신 버전의 iOS 시뮬레이터를 선택하는 것이 더 간단하고 안정적인 방법입니다. 아래와 같이 스크립트를 수정하는 것을 제안합니다.

# 설치된 iOS 버전 중 최신 버전의 iPhone 선택
        RESULT=$(python3 - <<'PY'
        import re, subprocess, sys

        text = subprocess.check_output(["xcrun", "simctl", "list", "devices"], text=True)
        lines = text.splitlines()

        def ver_key(v):
          return tuple(int(x) for x in v.split('.'))

        # 1) 최신 iOS 버전 찾기
        latest_ver = None
        for line in lines:
          header = re.match(r"^-- iOS ([0-9]+(?:\.[0-9]+)*) --$", line.strip())
          if not header:
            continue
          ver = header.group(1)
          if latest_ver is None or ver_key(ver) > ver_key(latest_ver):
            latest_ver = ver

Comment on lines +105 to +106
IOS_VER="${{ steps.pick_ios.outputs.ios_version }}"
DEVICE_NAME="${{ steps.pick_ios.outputs.device_name }}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

The GitHub Action uses expressions like ${{ steps.pick_ios.outputs.ios_version }} and ${{ steps.pick_ios.outputs.device_name }} directly within a bash run script. GitHub Actions expressions are substituted with their literal values before the shell script is executed. If the output of a previous step contains malicious characters (like double quotes or semicolons), it can lead to command injection. It is a security best practice to pass step outputs to the shell script using environment variables to prevent injection vulnerabilities.


xcodebuild -version

echo "Using scheme: ${{ inputs.scheme }}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

The GitHub Action uses the expression ${{ inputs.scheme }} directly within a bash run script. If an attacker can control the scheme input, they can inject arbitrary shell commands into the CI environment. To remediate this, pass the input to the shell script using an environment variable.

Example:

- name: Build
  shell: bash
  env:
    SCHEME: ${{ inputs.scheme }}
  run: |
    xcodebuild -scheme "$SCHEME" ...

Comment thread fastlane/Fastfile
Comment thread fastlane/Fastfile
Comment on lines +126 to +137
lane :upload_testflight_build do
api_key = asc_api_key
ipa_output_path = File.expand_path(TESTFLIGHT_IPA_OUTPUT_PATH, Dir.pwd)

UI.user_error!("Missing built ipa at #{ipa_output_path}") if !File.exist?(ipa_output_path)

upload_to_testflight(
api_key: api_key,
ipa: ipa_output_path,
skip_waiting_for_build_processing: true
)
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

deploy_testflight lane에서 api_key를 전달받을 수 있도록 이 lane의 시그니처를 수정하는 것을 권장합니다. 이렇게 하면 asc_api_key가 중복으로 호출되는 것을 방지하여 코드를 더 효율적으로 만들 수 있습니다.

  lane :upload_testflight_build do |options|
    options ||= {}
    api_key = options[:api_key] || asc_api_key
    ipa_output_path = File.expand_path(TESTFLIGHT_IPA_OUTPUT_PATH, Dir.pwd)

    UI.user_error!("Missing built ipa at #{ipa_output_path}") if !File.exist?(ipa_output_path)

    upload_to_testflight(
      api_key: api_key,
      ipa: ipa_output_path,
      skip_waiting_for_build_processing: true
    )
  end

@github-actions
Copy link
Copy Markdown

❌ iOS CI build failed.

build.log not found.

@opficdev opficdev merged commit aa73dc1 into develop Mar 11, 2026
2 checks passed
@opficdev opficdev deleted the fix/#255-fastlane branch March 11, 2026 07:42
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.

fastlane 배포 시 빌드 자동화를 우선 시행하도록 한다

1 participant