Fastlane iOS 연동
Fastlane을 사용 중인 Xcode 프로젝트라면 기존 파이프라인을 유지하면서 Fastfile에 DoveRunner Mobile App Security SDK 처리 단계만 추가하면 됩니다. 이 가이드는 두 가지 시나리오를 다룹니다:
- 로컬 Fastlane — 로컬 머신에서 Fastlane을 직접 실행하는 경우
- GitHub Actions + Fastlane — GitHub Actions CI 워크플로우에서 Fastlane을 실행하는 경우
로컬 Fastlane 설정
Section titled “로컬 Fastlane 설정”기본 Fastfile
Section titled “기본 Fastfile”TestApp_Swift 프로젝트의 일반적인 Fastfile은 다음과 같습니다:
default_platform(:ios)platform :ios do desc "Push a new beta build to TestFlight" lane :beta do increment_build_number(xcodeproj: "TestApp_Swift.xcodeproj") build_app(scheme: "TestApp_Swift") upload_to_testflight endendDoveRunner SDK 적용 후 Fastfile 수정
Section titled “DoveRunner SDK 적용 후 Fastfile 수정”DoveRunner Mobile App Security SDK를 적용하면 빌드와 배포 단계 사이에 추가 처리가 필요합니다. 텍스트 편집기로 Fastfile을 열고 SDK 패키지에 포함된 Fastlane Scripts/Fastfile 파일의 내용으로 전체를 교체하세요.
실행 전 다음 플레이스홀더 값을 실제 값으로 변경해야 합니다:
| 변수 | 설명 |
|---|---|
FASTLANE_USER | Apple 계정 이메일 |
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD | 앱 전용 비밀번호 |
PROFILE | 배포 단계에서 사용하는 프로비저닝 프로파일 이름 |
수정된 스크립트는 프로젝트 이름과 스키마를 프로젝트 폴더에서 자동으로 추출하도록 설계되어 있어, 다른 프로젝트에도 동일한 Fastfile을 수정 없이 사용할 수 있습니다.
변경 후 기존과 동일하게 fastlane beta를 실행하면 앱 빌드 → IPA 내보내기 → generate_hash 스크립트 실행 → DoveRunner SDK가 적용된 IPA TestFlight 업로드 순서로 자동 처리됩니다.
GitHub Actions + Fastlane
Section titled “GitHub Actions + Fastlane”브랜치에 push할 때 GitHub Actions로 빌드와 배포를 자동화하는 파이프라인을 구성할 수 있습니다.
다음 값들을 GitHub Actions Secrets에 등록해야 합니다:
| Secret | 설명 |
|---|---|
KEY_ID | App Store Connect API Key ID |
API_KEY | App Store Connect API Key |
PRIVATE_KEY | App Store Connect API Private Key |
DoveRunner SDK가 후처리 과정에서 IPA를 재서명하므로, 다음 파일을 리포지토리에 포함시켜야 합니다:
| 파일 | 설명 |
|---|---|
certificate.p12 | PKCS#12 형식의 배포 인증서 (비밀번호: 123456) |
distribution.mobileprovision | 배포용 프로비저닝 프로파일 |
GitHub Actions 워크플로우 (ios_build.yml)
Section titled “GitHub Actions 워크플로우 (ios_build.yml)”SDK 패키지의 Fastlane Scripts/ios_build.yml 파일 내용으로 기존 워크플로우 파일을 교체합니다. 기본 구조는 다음과 같습니다:
name: iOS Build & Deployon: push: branches: - developjobs: release-ios: name: Build and release iOS app runs-on: macos-15 steps: - uses: actions/checkout@v2
- uses: actions/setup-ruby@v1 with: ruby-version: '3.1.2'
- name: Install Fastlane run: cd ios && bundle install
- name: Install pods run: cd ios && pod install
- name: Execute Fastlane env: APP_STORE_CONNECT_KEY_ID: ${{ secrets.KEY_ID }} APP_STORE_CONNECT_API_KEY: ${{ secrets.API_KEY }} APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} run: cd ios && fastlane releaseGitHub Actions용 Fastfile
Section titled “GitHub Actions용 Fastfile”SDK 패키지의 Fastlane Scripts/Fastfile_GithubAction 파일 내용으로 Fastfile을 교체합니다. 기본 구조는 다음과 같습니다:
default_platform(:ios)platform :ios do desc "Release to App Store" lane :release do # App Store Connect API 인증 app_store_connect_api_key( key_id: ENV["APP_STORE_CONNECT_KEY_ID"], issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"], key_content: ENV["APP_STORE_CONNECT_PRIVATE_KEY"] )
# 앱 빌드 build_app( scheme: "scheme_name_of_project", export_method: "app-store" )
# TestFlight 업로드 upload_to_testflight( skip_waiting_for_build_processing: true, distribute_external: true ) endend이 스크립트는 전체 파이프라인을 자동으로 처리합니다:
- App Store Connect API 인증
- 앱 정보 조회 및 빌드 번호 자동 증가
- 앱 빌드 및 IPA 내보내기
- DoveRunner SDK의
generate_hash스크립트 실행 - 배포 인증서와 프로파일로 IPA 재서명
- App Store Connect에 업로드
프로젝트 이름, 스키마, 타겟, 번들 ID 등 필요한 값은 모두 프로젝트 파일에서 자동 추출되므로, 어떤 프로젝트에도 동일한 스크립트를 수정 없이 사용할 수 있습니다.