Fastlane (2)

HYUNGU, KANG·2022년 10월 12일
3

Fastlane

목록 보기
2/4

이 글에서는 실제 연동까지 실습을 진행하지는 않습니다.
단순히 진행에 필요한 기본 배경지식만을 설명합니다.

Plugin 관리

새로운 Plugin 추가

fastlane add_plugin [name]

Plugin 설치

fastlane install_plugins

Plugin 제거

fastlane/Pluginfile 파일의 gem "fastlane-plugin-[plugin_name]" 라인 제거

iOS 설정

iOS Match (인증서 관리툴) 설정해보기

match - https://docs.fastlane.tools/actions/match/
plugin 의 한종류, 인증서와 provisioning profiles 관리를 도와준다.

적용 전
When deploying an app to the App Store, beta testing service or even installing it on a device, most development teams have separate code signing identities for every member. This results in dozens of profiles including a lot of duplicates.

You have to manually renew and download the latest set of provisioning profiles every time you add a new device or a certificate expires. Additionally this requires spending a lot of time when setting up a new machine that will build your app.

적용 후
Share one code signing identity across your development team to simplify your setup and prevent code signing issues. What if there was a central place where your code signing identity and profiles are kept, so anyone in the team can access them during the build process?


Signing certificates
어플리케이션을 빌드할때 인증서를 사용해 서명, 인증서에는 소유자에 대한 증명이 들어있음

빌드를 하기 위해서는 멤버들이 인증서를 가지고 있어야 한다.
인증서에는 발급 제한이 있는데, 이렇게 되면 멤버가 늘어나서 환경을 세팅할때마다 인증서를 소유한 사람이 export 해서 전달하고 import 해야한다.

Android 와 달리, iOS 에서는 인증서 무효화/재발급을 얼마든지 해도 문제가 없음
잃어버렸다? 안쓰는데 발급된게 있다? 무효화 > 재발급!

Provisioning profiles
App id(bundle id), Certificates, Devices uuid 정보등을 포함하고 있다.

디바이스에 설치할때 올바른지 정보를 확인하는 용도, 개발용 앱을 설치할때 포함된 정보와 일치하는지 확인 후 설치한다.

자세한 정보를 위한 참고 링크
https://abhimuralidharan.medium.com/what-is-a-provisioning-profile-in-ios-77987a7c54c2


결론적으로 개발자가 자신의 환경에서 빌드를 하기 위해서 필요한 팀의 Signing certificates, Provisioning profiles 를 One source 로 관리하고, 이를 팀 멤버들이 쉽게 자신의 환경에 설치 가능하도록 도와준다.

만약 match 를 설정하기 전에 인증서가 너무 추적이 안될정도로 무분별하게 관리가 되고있거나, 더이상 발급이 불가능하다면, 아래의 명령어를 통해서 모든 인증서를 무효화 한 뒤 설정 하는것을 고려해볼수도 있다.
fastlane match nuke development
fastlane match nuke distribution

초기 설정은 fastlane match init 명령어를 실행하면 되고, Git repo / Google Cloud / Amazon S3 중 어디에 Signing certificates, Provisioning profiles 를 저장하고 관리할것인지 선택한 뒤, 스토리지 인증수단 등을 입력하면 기본 스토리지 설정이 끝난다.

이후에는 fastlane match developmentfastlane match appstore 를 실행하면, 위에서 설정한 스토리지에 Signing certificates, Provisioning profiles 발급 및 업데이트를 진행한다. (다른 디바이스에서 스토리지에 저장된 파일들을 불러오려면, 동일한 명령어를 실행해주면 된다.)

만약 다양한 bundle identifier (예를들면 Notification extension, Watch application) 등에 대해서 발급을 받아야 하는 경우
fastlane match appstore -a tools.fastlane.app,tools.fastlane.app.watchkitapp
와 같이 명령어를 사용해서 지정도 가능하다.

** Match 설정 이후에는, XCode 프로젝트에서 인증서와 Provisioning profiles 를 수동으로 변경해주어야 한다. (Build settings)

CD 환경에서 Fastfile 스크립트 실행중 match로 인증서 설정이 필요한 경우에는 아래처럼 Fastfile을 작성할 수 있다.

lane :certificates do
  match(app_identifier: ["tools.fastlane.app", "tools.fastlane.app.watchkitapp"])
end

iOS Fastfile 작성 및 로컬에서 IPA 추출해보기

lane :build_ios do
  # set version
  # set build number
  # set match or nothing
  build_app(workspace: "MyProject.xcworkspace", scheme: "MyAppScheme")
  # upload to testflight
end
profile
JavaScript, TypeScript and React-Native

0개의 댓글