본문 바로가기

Live Update 또는 Native Build 자동 선택

대부분의 Capacitor 릴리스는 JavaScript만 포함하므로 다음과 같이 배포해야 합니다 live update를. 일부 변경 사항은 네이티브 code에 영향을 주며, 에서 새로운 바이너리가 필요합니다. Capgo 빌드. 이 가이드는 GitHub Actions, GitLab CI 또는 기타 CI/CD 플랫폼이 모든 push 시 사람이 개입하지 않고도 올바른 경로를 선택하는 방법을 보여줍니다.

Capgo는 이미 안전한 경로가 무엇인지 알고 있습니다. 웹 빌드 후(업로드 또는 네이티브 빌드 요청 전) 다음을 실행하세요:

터미널 창
npx @capgo/cli@latest bundle releaseType com.example.app --channel production
# → OTA ship with bundle upload
# → native ship with Capgo Build

OTA 네이티브 패키지가 채널에 이미 라이브인 것과 일치한다는 의미입니다. native 플러그인, Capacitor 버전 또는 기타 네이티브 의존성이 변경되었음을 의미합니다 — OTA 번들만으로는 해당 기기를 안전하게 업데이트할 수 없습니다.

releaseType 비교합니다 네이티브 패키지 메타데이터 (Capacitor/Cordova 플러그인과 버전). 이는 하지 마세요 아래의 모든 변경 사항 보기 ios/, android/, 또는 capacitor.config.*. git에서 해당 경로를 먼저 제한한 다음 사용하세요 releaseType 의존성 호환성을 위해 — 아래 예시는 두 가지 모두를 수행합니다.

자세한 내용은 Native 호환성 전체 규칙과 매뉴얼 bundle compatibility 표.

  • Capgo 앱이 등록되어 있고 Capgo API 키 CI 시크릿에 CAPGO_TOKEN
  • Live Updates 업로드가 정상 작동하는지 확인 (bundle upload) — 참고 CI/CD 통합
  • 네이티브 작업이 예상되는 경우 CI에 Capgo 빌드 자격 증명을 설정 — 참고 GitHub 작업 또는 인증 정보
  • 이미 존재하며 프로덕션과 일치하는 채널(예시에서는 production)
  • 채널을 metadata 전략을 사용하면 모든 upload가 --auto-min-update-version (1회성):
터미널 창
npx @capgo/cli@latest channel set production com.example.app --disable-auto-update metadata

파이프라인 동작 방식

“How the Pipeline Should Work” 섹션
  1. 평소와 같이 웹 에셋을 빌드합니다.
  2. 커밋이 다음을 건드리면 ios/, android/, 또는 capacitor.config.*, Native Build 경로를 강제하세요.
  3. 그렇지 않으면 Capgo에게 releaseType 커밋이 OTA에 안전한지 물어보세요.
  4. 만약 OTA, ...로 upload하세요 --fail-on-incompatible 및 --auto-min-update-version.
  5. 만약 native, Capgo Build를 실행한 뒤, 일치하는 번들을 ...로 upload하여 --auto-min-update-version 채널의 native metadata가 업데이트되도록 하세요. 하지 마세요 사용하세요 --fail-on-incompatible 해당 베이스라인 업로드용입니다. 새 네이티브 패키지는 서로 달라야 합니다. 자세한 내용은 Native + OTA 채널 워크플로우 채널 레벨 FAQ를 참조하세요.

네이티브 경로를 게이트한 다음, 조건에 따라 분기하는 하나의 워크플로우입니다. releaseType:

.github/workflows/capgo-release.yml
name: Capgo Release
on:
push:
branches: [main]
jobs:
decide:
runs-on: ubuntu-latest
outputs:
release_type: ${{ steps.verdict.outputs.type }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Decide OTA vs native
id: verdict
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
run: |
BEFORE="${{ github.event.before }}"
if [ -z "$BEFORE" ] || [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
BEFORE="$(git rev-parse HEAD~1 2>/dev/null || echo '')"
fi
if [ -z "$BEFORE" ] || git diff --name-only "$BEFORE" "${{ github.sha }}" \
| grep -qE '^(ios/|android/|capacitor\.config\.)'; then
TYPE=native
echo "Native path/config changed (or no prior commit) — forcing native"
else
TYPE=$(npx @capgo/cli@latest bundle releaseType com.example.app --channel production | tr -d '[:space:]')
fi
echo "type=$TYPE" >> "$GITHUB_OUTPUT"
echo "Capgo release type: $TYPE"
live_update:
needs: decide
if: needs.decide.outputs.release_type == 'OTA'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Upload live update
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
run: |
npx @capgo/cli@latest bundle upload com.example.app \
--channel production \
--fail-on-incompatible \
--auto-min-update-version
native_build:
needs: decide
if: needs.decide.outputs.release_type == 'native'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: [ios, android]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npx cap sync ${{ matrix.platform }}
- name: Capgo Build ${{ matrix.platform }}
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
CAPGO_IOS_PROVISIONING_MAP: ${{ secrets.CAPGO_IOS_PROVISIONING_MAP }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE_FILE }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
PLAY_CONFIG_JSON: ${{ secrets.PLAY_CONFIG_JSON }}
run: |
npx @capgo/cli@latest build request com.example.app \
--platform ${{ matrix.platform }} \
--build-mode release
native_bundle:
needs: [decide, native_build]
if: needs.decide.outputs.release_type == 'native'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Upload bundle for new native baseline
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
run: |
# Channel must already be on metadata (see Prerequisites above)
npx @capgo/cli@latest bundle upload com.example.app \
--channel production \
--auto-min-update-version

교체 com.example.app 그리고 다음 문서에 설명된 대로 서명 시크릿을 연결하세요. Capgo Build용 GitHub Actions.

GitLab은 rules pipeline이 생성될 때 평가하므로, shell이 포함된 브랜치는 if 하나의 deploy job 안에서(또는 동적 child pipeline을 생성, 별도의 native matrix job이 필요하면):

.gitlab-ci.yml
image: node:24
stages:
- build
- deploy
variables:
APP_ID: com.example.app
CHANNEL: production
build_web:
stage: build
script:
- npm ci
- npm run build
artifacts:
paths:
- dist/
- node_modules/
expire_in: 1 hour
only:
- main
deploy:
stage: deploy
needs: [build_web]
script:
- |
BEFORE="${CI_COMMIT_BEFORE_SHA:-}"
if [ -z "$BEFORE" ] || [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
BEFORE="$(git rev-parse HEAD~1 2>/dev/null || echo '')"
fi
if [ -z "$BEFORE" ] || git diff --name-only "$BEFORE" "$CI_COMMIT_SHA" \
| grep -qE '^(ios/|android/|capacitor\.config\.)'; then
TYPE=native
else
TYPE=$(npx @capgo/cli@latest bundle releaseType "$APP_ID" --channel "$CHANNEL" | tr -d '[:space:]')
fi
echo "Capgo release type: $TYPE"
if [ "$TYPE" = "OTA" ]; then
npx @capgo/cli@latest bundle upload "$APP_ID" \
--channel "$CHANNEL" \
--fail-on-incompatible \
--auto-min-update-version
elif [ "$TYPE" = "native" ]; then
npx cap sync
npx @capgo/cli@latest build request "$APP_ID" --platform ios --build-mode release
npx @capgo/cli@latest build request "$APP_ID" --platform android --build-mode release
npx @capgo/cli@latest bundle upload "$APP_ID" \
--channel "$CHANNEL" \
--auto-min-update-version
else
echo "Unexpected release type: $TYPE" >&2
exit 1
fi
only:
- main

스토어 CAPGO_TOKEN 및 Capgo Build 서명 변수를 masked/protected CI/CD 변수로 설정하세요.

동일한 세 단계가 어디서나 적용됩니다:

단계명령어
결론npx @capgo/cli@latest bundle releaseType APP_ID --channel production
OTA 경로npx @capgo/cli@latest bundle upload APP_ID --channel production --fail-on-incompatible --auto-min-update-version
네이티브 경로npx @capgo/cli@latest build request APP_ID --platform ios (또는 android) --build-mode release

셸 종료 코드/표준 출력을 플랫폼 조건문에 매핑하세요 (또는 셸을 사용하는 단일 작업을 유지하세요 if, 위 GitLab 예시처럼):

  • Azure Pipelines — 스크립트 단계에서 출력 변수를 설정한 후, 다음을 사용하세요 condition: eq(variables['releaseType'], 'OTA')
  • Bitbucket Pipelines — 다음을 작성하세요 RELEASE_TYPE=… 대상 $BITBUCKET_PIPELINES_VARIABLES_PATH, 아래에 선언하세요 output-variables, 그리고 이후 단계를 분기하세요 condition: state: RELEASE_TYPE == "OTA" (파일 아티팩트만으로는 구동할 수 없으며 condition)
  • CircleCI — when 는 설정 컴파일 시점에 평가되므로 런타임 셸로 분기하세요 if (또는 동적 설정/연속 처리), 워크스페이스 값이 아닌 when
  • Jenkins를 — stdout을 환경 변수로 캡처하고 when { environment name: 'RELEASE_TYPE', value: 'OTA' }

경로 필터 (선택적 속도 향상)

“Paths Filters (Optional Speedup)” 섹션

Path filters는 비용 최적화 수단이지 Capgo 체크의 대체재가 아닙니다. 취약한 allowlist를 관리하기보다 docs 전용 경로를 제외하는 것을 권장합니다 — 웹 빌드는 종종에도 의존하므로 vite.config.*, tsconfig*.json, 그리고 프레임워크 설정 파일:

on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'

대신 allowlist를 사용한다면, 다음뿐 아니라 웹 및 native build가 읽는 모든 입력을 포함하세요. src/ 및 package.json.

CI가 native를 선택한 경우:

  1. Capgo Build는 서명된 바이너리를 생성하고 TestFlight / Play에 제출할 수 있습니다(참고 설정).
  2. 일치하는 JS bundle을 다음으로 upload하세요 --auto-min-update-version (metadata strategy)를 사용해 채널이 새 native 패키지를 기록하도록 합니다. 그렇지 않으면 다음 JS-only commit에서도 여전히 native.
  3. 사용자가 새 바이너리를 설치하면, 이후 JavaScript-only commit은 다시 OTA 다시.