-
반응형
Fastlane iOS 설정에 이어서 Flutter 설정도 해보겠습니다~~
[Flutter] Fastlane 이용해서 배포 자동화 하기 #1 iOS 설정
Flutter를 사용한다고 해도, 결국 각 플랫폼 폴더 /ios /android 에서 각각 설정을 해줘야 한다. 그래서 이번에 진행해봄 김에 전체적으로 정리해보기로 했습니다 기본 설정 일단 Fastlane은 ruby로 설치
jooeungen.tistory.com
지금 파일 구조는 다음과 같다.
myTestAp ㄴ/lib ㄴ/ios ㄴ/fastlane ㄴ/android ㄴ/fastlane
지금 추가하는 deploy.sh 스크립트는 Flutter App Root에 위치한다.
#!/usr/bin/env bash if [[ $# -lt 2 ]] ; then echo 'Please provide both environment and platform: "firebase", "release" for environment and "ios", "android", "all" for platform.' exit 1 fi environment=$1 platform=$2 if [[ $platform == "ios" || $platform == "all" ]]; then case $environment in firebase) # Fastlane iOS echo "Deploying to iOS BETA Firebase..." cd ./ios bundle exec fastlane firebase_beta cd .. ;; firebase_staging) # Fastlane iOS echo "Deploying to iOS STAGING Firebase..." cd ./ios bundle exec fastlane firebase_staging cd .. ;; release) # Fastlane iOS echo "Deploying to iOS Appstore..." cd ./ios bundle exec fastlane release cd .. ;; *) echo 'Please type environments: "firebase", "firebase_staging", "release"' ;; esac fi // .. 중략 ..//
이부분은 나도 잘 모르겠어서 저렇게 짜긴 했는데 ..
flutter build ios 명령어를 통해서 한번 플러터 프로젝트로 빌드를 실행 한다.그러고나서 flastlane firebase를 호출하고 있기 때문에 여기서 다시 build_app 함수를 통해 다시 adhoc 빌드를 하게 되는데, 이럼 빌드를 두번하는것 아닌가 ? 싶긴 한데 더 좋은 방법을 찾지 못했다.(build_app 함수에서 provisioning 등을 설정해주는게 있어서 .. flutter쪽 함수를 쓸수 있는지가 애매..)ㄴ요건 iOS 코드에 해결해두었습니다 ~ 핳핳
여튼 iOS 쪽 코드는 어렵지 않다.
만약 빌드 업로드 전 빌드 버전을 올리고 싶다면
아래 코드를 통해서 하면된다.
사실 쉘스크립트 잘 모르는데 GPT가 많이 도와줌 .. 이거 없이 개발 어찌함니까
# Get current version and build number from pubspec.yaml current_version=$(grep 'version: ' ./pubspec.yaml | cut -d '+' -f 1 | cut -d ' ' -f 2) current_build_number=$(grep 'version: ' ./pubspec.yaml | cut -d '+' -f 2) # Increase build number by 1 new_build_number=$((current_build_number + 1)) # Check if -noversion option is not set if [[ $3 != "-noversion" ]]; then # Replace old build number with new build number in pubspec.yaml sed -i '' -e "s/version: ${current_version}+${current_build_number}/version: ${current_version}+${new_build_number}/g" ./pubspec.yaml echo "s/version: ${current_version}+${current_build_number}/version: ${current_version}+${new_build_number}/g" git add pubspec.yaml git commit -m "Update version ${current_version}+${new_build_number}" fi
여튼 이렇게 셋업해두면
sh deploy.sh firebase ios
sh deploy.sh firebase all
sh deploy.sh release ios
이런식으로 한번에 빌드할 수 있다. -noversion 옵션을 넣으면 버전 업데이트는 스킵한다.반응형'개발' 카테고리의 다른 글
Realm Encryption 사용시 Encryption Export Regulations 설정하기 (1) 2023.11.17 [AppStore] access to cloud-managed distribution certificates 문제 해결 (0) 2023.08.01 [Xcode] DVTPortalServiceErrorDomain Code=1100 "Your session has expired. Please log in." 에러 해결하기 (0) 2023.06.22 [Flutter] Fastlane 이용해서 배포 자동화 하기 #1 iOS 설정 (0) 2023.06.22 [Flutter] Localization 적용하기 (0) 2023.06.07 댓글