2023.07.23, 월요일 오후 9시에 진행된 'GitSpace 1회 세미나'의 발표 자료입니다.
iOS 앱의 배포 자동화를 위한 루비 기반 라이브러리 'fastlane' 를 소개합니다.
**GitSpace는 'GitSpace' 앱을 개발한 멤버들의 모임으로, 정기적인 회의와 기술 세미나를 진행하고 있습니다.
6. 2. fastlane 소개
The easiest way to build and release mobile apps.
• 모바일 앱의 개발과 배포 과정을 자동화해주는 오픈 소스 플랫폼
1. 스크린샷 자동화
2. 배타 버전 배포
3. 앱 스토어 배포
4. 코드 사이닝
• Android, iOS, Closs Platform
9. 3. fastlane 적용하기
E A S Y
lane :beta do
increment_build_number
build_app
upload_to_testflight
end
lane :release do
capture_screenshots
build_app
upload_to_app_store # Upload the screenshots and the binary to iTunes
slack # Let your team-mates know the new version is live
end
Step 1. Fastfile 생성하기
10. 3. fastlane 적용하기
E A S Y
Step 2. fastlane 실행하기
# generate ‘release’ lane
fastlane release
# generate ‘beta’ lane
faselane beta
14. 3. fastlane 적용하기
Getting Started
Step 1. fastlane 설치하기
1-1. Managed Ruby environment + Bundler (macOS/Linux/Windows)
• ruby 설치
• Bundler 설치
• ./Gemfile 파일을 프로젝트의 최상단 디렉토리에 생성
15. *Ruby, Bundler 설치하기
1. Homebrew로 rbenv 설치
2. rbenv를 이용하여 ruby 설치
3. bundler 설치
$ brew install rbenv
$ echo ‘eval “$(rbenv init -)”’ >> ~/.zshrc
$ rbenv install 3.1.2 # 버전이다.
$ gem install bundler
16. 1. Homebrew로 ruby 설치
2. shell 환경설정
3. bundler 설치
$ brew install ruby
$ gem install bundler
$ open -e ~/.zshrc
*Ruby, Bundler 설치하기
if [ -d "/opt/homebrew/opt/ruby/bin" ]; then
export PATH=/opt/homebrew/opt/ruby/bin:$PATH
export PATH=`gem environment gemdir`/bin:$PATH
fi
17. 3. fastlane 적용하기
Getting Started
Step 1. fastlane 설치하기
1-1. Managed Ruby environment + Bundler (macOS/Linux/Windows)
• ruby 설치
• Bundler 설치
• ./Gemfile 파일을 프로젝트의 최상단 디렉토리에 생성
18. *Gemfile 생성하기, fastlane 설치하기
1. Gem
fi
le 파일 생성
2. gem 설치하기
3. Gem
fi
le.lock은 위의 명령어를 실행하면 자동으로 생성된다.
source ‘https://rubygems.org'
gem ‘fastlane’
bundle install
23. 3. fastlane 적용하기
Getting started with fast lane for iOS
Step 1. Xcode command line tools(macOS)
xcode-select --install
24. 3. fastlane 적용하기
Getting started with fast lane for iOS
Step 2. 로케일(Locale) 관련 환경변수(environment variables) 세팅하기
$ open ~/.zshrc # ~/.bashrc ~/.bash_profile ~/.profile ~/.zshrc
export LC_ALL=ko_KR.UTF-8
export LANG=ko_KR.UTF-8
$ source ~/.zshrc
25. 3. fastlane 적용하기
Getting started with fast lane for iOS
Step 3. fastlane 설치를 위한 Ruby, Bundler 설치하기
• 루비+번들러 설치
• 홈브류로 fastlane 설치할 경우 Gem
fi
le을 만들 필요 없다.
$ brew install ruby
$ gem install bundler
$ open -e ~/.zshrc
if [ -d "/opt/homebrew/opt/ruby/bin" ]; then
export PATH=/opt/homebrew/opt/ruby/bin:$PATH
export PATH=`gem environment gemdir`/bin:$PATH
fi
26. 3. fastlane 적용하기
Getting started with fast lane for iOS
Step 4. fastlane 설치를 위한 Gem
fi
le 생성하기
• iOS 프로젝트의 root 디렉토리에 생성할 것
• bundle install 하면 Gem
fi
le.lock도 만들어진다.
source ‘https://rubygems.org'
gem ‘fastlane’
bundle install
27. 3. fastlane 적용하기
Getting started with fast lane for iOS
Step 5. fastlane 기본 설정
• fastlane을 프로젝트에 적용하기 위한 설정을 해주자.
• 1~4번까지 선택지가 나오는데, 어차피 나중에 다시 또 설정할 수 있으므로 필요한 것을 먼저 해주자.
• 4번으로 기본 메뉴얼 세팅을 해도 좋다.
• 여기서는 앱스토어 배포 자동화를 다루고 있으므로, 3번으로 진행한다.
fastlane init
28.
29. 3. fastlane 적용하기
Getting started with fast lane for iOS
Step 5. fastlane 기본 설정
• fastlane을 프로젝트에 적용하기 위한 설정을 해주자.
• 1~4번까지 선택지가 나오는데, 어차피 나중에 다시 또 설정할 수 있으므로 필요한 것을 먼저 해주자.
• 4번으로 기본 메뉴얼 세팅을 해도 좋다.
fastlane init
34. 4. fastlane으로 앱스토어 배포 자동화하기
iOS App Store deployment using fastlane
Step 1. App
fi
le 수정하기
• 앱 번들 ID, 애플 ID 등등을 입력해주자.
# The bundle identifier of your app
app_identifier("com.GitSpace.RBG")
# Your Apple Developer Portal username
apple_id(“12345@gmail.com”)
# Developer Portal Team ID
# team_id(“ABCEDFG”)
35. 4. fastlane으로 앱스토어 배포 자동화하기
iOS App Store deployment using fastlane
Step 2. ‘release’ lane 구성하기
platform :ios do
desc “Deploy App Store”
lane :release do
get_certificates
get_provisioning_profile
increment_build_number(
build_number: latest_testflight_build_number + 1
)
build_app(
scheme: “GitSpace”
)
upload_to_app_store
slack(message: “성공적으로 앱스토어 배포!”)
end
36. 4. fastlane으로 앱스토어 배포 자동화하기
iOS App Store deployment using fastlane
Step 2. ‘release’ lane 구성하기
platform :ios do
…
error do |lane, exception, options|
slack(
message: “에러 발생: #{excetion}”,
success: false,
slack_url: “~”
)
end
end
37. 4. fastlane으로 앱스토어 배포 자동화하기
iOS App Store deployment using fastlane
Step 3. fastlane release !!
fastlane release
38. reference
• fastlane 공식 홈페이지
• fastlane 공식 문서
• Bundler 공식 문서
• iOS 앱 배포 자동화를 위한 Fastlane 설치 및 구성
• iOS — 배포 자동화, Fastlane 시작부터 적용까지
• Fastlane을 이용한 앱 자동 배포
• Fastlane 배포 자동화 적용(feat. iOS)
• [fastlane] 5. fastlane deliver로 Apple Store에 배포, TestFlight 배포
• what's difference between installing fastlane using homebrew cask, gem install and prepackaged
• homebrew vs bundler
• What is the difference between Bundler and HomeBrew?
• Don't Use the Mac System Ruby – Use This Instead
• Mac에 Ruby 설치하기(homebrew)
• How to install Ruby in a macOS for local development
• Install Ruby 3.1 · macOS