Programming/React Native

[ReactNative] CodePush

통통만두 2021. 8. 4. 13:59
반응형

2021.07.20 - [Programming/React Native] - [ReactNative] Code push를 위한 App center 연동

 

[ReactNative] Code push를 위한 App center 연동

CodePush는 MS에서 만든 App Center https://appcenter.ms/ App Center 홈페이지에 가서 가입을 진행한 후 아래와 같이 앱을 등록합니다. 앱을 등록하실 때 본인의 서비스 명칭이 myservice 라고 한다면 꼭 ios는..

marsland.tistory.com

2021.08.03 - [Programming/React Native] - [ReactNative] CodePush 셋팅

 

[ReactNative] CodePush 셋팅

2021.07.20 - [Programming/React Native] - [ReactNative] Code push를 위한 App center 연동 appcenter login ➜ marsland git:(master) ✗ appcenter login Opening your browser... ? Visit https://appcenter..

marsland.tistory.com

 

앞에서 appcenter과 codepush를 할 준비는 마쳤다. 이제 codepush를 통해서 소스를 배포해보도록 하자.

appcenter 로그인

➜  marsland git:(master) ✗ appcenter login
Opening your browser... 
? Visit https://appcenter.ms/cli-login?hostname=marsland-ui-MacBookPro.local and enter the code:
? Access code from browser:

이 때, 브라우저에 탭이 하나 열리는데 거기에 표시되는 token을 복사해서 붙여넣으면 로그인이 완료된다.

 

현재 작업중인 앱 확인

➜  marsland git:(master) ✗ appcenter apps get-current

아무것도 나오지 않는다면 작업중인 앱이 없는거다.

 

작업중인 앱 지정

appcenter apps set-current ${계정명}/${앱명}
appcenter apps set-current marsland/service-android

위의 명령어를 완료하면 아무런 메세지도 나오지 않기에, 현재 작업 중인 앱을 다시 확인한다.

 

배포 목록 조회

➜  marsland git:(master) ✗ appcenter codepush deployment list
Note: To display deployment keys add -k|--displayKeys option
┌────────────┬─────────────────────┬──────────────────────┐
│ Name       │ Update Metadata     │ Install Metrics      │
├────────────┼─────────────────────┼──────────────────────┤
│ Staging    │ No updates released │ No installs recorded │
├────────────┼─────────────────────┼──────────────────────┤
│ Production │ No updates released │ No installs recorded │
└────────────┴─────────────────────┴──────────────────────┘

저 명령어를 실행해도 배포키는 나오지 않는데, 배포키를 보려면 -k 옵션을 추가해서 실행하도록 한다.

➜  marsland git:(master) ✗ appcenter codepush deployment list -k
┌────────────┬───────────────────────────────────────┐
│ Name       │ Key                                   │
├────────────┼───────────────────────────────────────┤
│ Staging    │ ygX6KOkhSS511lPnXOSJe6jDSsOX9E1RnZ8yV │
├────────────┼───────────────────────────────────────┤
│ Production │ qstVoqJBDRX0nnYIrFp0tlAfwGmt0h8s70v-_ │
└────────────┴───────────────────────────────────────┘

노파심에서 말하는거지만, 위에 보이는 key는 유효한 key가 아니다 ^^

 

real push

➜  marsland git:(master) ✗ appcenter codepush release-react -d Production
Detecting android app version:

Using the target binary version value "1.0" from "android/app/build.gradle".

Running "react-native bundle" command:

node node_modules/.bin/react-native bundle --assets-dest /var/folders/6l/y9wrfvdx36g7rq08wnlyjzb80000gn/T/code-push202174-40215-1k131d5.wv7p/CodePush --bundle-output /var/folders/6l/y9wrfvdx36g7rq08wnlyjzb80000gn/T/code-push202174-40215-1k131d5.wv7p/CodePush/index.android.bundle --dev false --entry-file index.js --platform android
Welcome to Metro!
              Fast - Scalable - Integrated

info Writing bundle output to:, /var/folders/6l/y9wrfvdx36g7rq08wnlyjzb80000gn/T/code-push202174-40215-1k131d5.wv7p/CodePush/index.android.bundle
info Done writing bundle output
info Copying 36 asset files
info Done copying assets

Releasing update contents to CodePush:


Your target-binary-version "1.0" will be treated as "1.0.X".

배포 명령어를 실행하면 뭐 대충 위처럼 쿵떡쿵떡해서 알아서 배포가 된다.

그러면, 앱에 심어둔 codepush의 정책에 따라서 앱 실행, 수동 업데이트 등등의 방법으로 소스가 적용 된다.

반응형