자동 선택 Live Update 또는 네이티브 빌드
설치
대부분의 Capacitor 릴리스는 자바스크립트만으로 구성되어 있으며 바이너리 없이 배포할 수 있습니다. live updatecode 빌드 Capgo 빌드. This guide shows how to make GitHub Actions, GitLab CI, or any other CI/CD platform pick the correct path on every push — without a human deciding.
Capgo은 이미 안전한 경로를 알고 있습니다. 웹 빌드 후 (업로드 또는 네이티브 빌드 요청하기 전에) 실행하세요:
npx @capgo/cli@latest bundle releaseType com.example.app --channel production# → OTA ship with bundle upload# → native ship with Capgo BuildOTA 채널에 이미 라이브로 있는 네이티브 패키지가 native 패키지와 일치한다는 것을 의미합니다. native Capacitor 버전 또는 다른 네이티브 종속성이 플러그인으로 변경된 경우 — 안전하게 장치에 업데이트하기 위해 오버-더-에어 배포만으로는 안전하지 않습니다.
releaseType 비교 네이티브 패키지 메타데이터 Capacitor/Cordova 플러그인 및 버전 모두 모두 ios/, android/모두 capacitor.config.*모두 releaseType 모두
모두 자연적인 호환성 전체 규칙과 수동 매뉴얼을 참조하세요. bundle compatibility 표.
사전 요구 사항
제목 ‘사전 요구 사항’- Capgo 앱이 등록되어 있고, CI 비밀에 Capgo __CAPGO_KEEP_1__ 키가 Capgo API 키 CI 비밀
CAPGO_TOKEN - 실시간 업데이트가 업로드 작동 (
bundle upload) — 참조 CI/CD 통합 - Capgo CI에서 네이티브 작업을 기대하는 경우 네이티브 잡 빌드 인증서를 설정하십시오 — 참조 GitHub 액션 또는 Credentials
- 인증서
production) - 이미 존재하는 채널이 프로덕션과 일치하고 (예시를 참조하십시오)
metadata채널--auto-min-update-version(one-time):
npx @capgo/cli@latest channel set production com.example.app --disable-auto-update metadatapipeline이 어떻게 작동해야 하는가
pipeline이 어떻게 작동해야 하는가flowchart TD A[Push / merge] --> B[Install + web build] B --> C["bundle releaseType"] C -->|OTA| D["bundle upload"] C -->|native| E["build request iOS + Android"] E --> F[Store / TestFlight / Play]
- 일반적인 웹 자산 빌드
- 커밋이 touches
ios/,android/, 또는capacitor.config.*, native 경로 강제 - Capgo이 커밋이 OTA-safe인지 묻습니다.
releaseType만약 - , 업로드
OTA및--fail-on-incompatible페이지에 신뢰--auto-min-update-version. - If
native, Capgo Build을 실행한 후, Capgo Build과 일치하는 패키지를 업로드하세요.--auto-min-update-version그렇게 채널의 네이티브 메타데이터가 업데이트됩니다. 하지 마세요. use--fail-on-incompatible그것을 사용하지 마세요. 그것을 사용하지 마세요. Native + OTA Channel Workflow
GitHub 작업
GitHub Actions원하는 워크플로우는 네이티브 경로를 제어하고, 그 다음에 branch on을 사용하여 releaseType:
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_KEEP_0__에서 설명된 서명 비밀을 연결합니다. Capgo 빌드에 대한 GitHub 액션.
GitLab CI
GitLab CI 섹션GitLab은 pipeline이 생성될 때 rules branch에 shell이 포함된 하나의 배포 작업 (또는 동적 자식 pipeline을 생성하는 경우) if 필요한 경우 별도의 네이티브 매트릭스 작업을 생성합니다. .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다른 CI 플랫폼 CAPGO_TOKEN CI/CD 변수로 Capgo 빌드 인증 변수를 보호/가리기ます.
다른 CI 플랫폼
다른 CI 플랫폼어디서든 같은 세 단계가 작동합니다.
| Step | Command |
|---|---|
| 결과 | 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 |
Shell 종료/표준 출력을 플랫폼의 조건문에 매핑하거나 단일 작업에 shell을 유지하세요. ifAzure Pipelines
- — set an output variable from a script step, then use GitLab
condition: eq(variables['releaseType'], 'OTA') - Bitbucket Pipelines — write
RELEASE_TYPE=…to$BITBUCKET_PIPELINES_VARIABLES_PATHcontext:Page/area: Live updates product page. Role: Short UI label or navigation item. Message key `live_update_dynamic_label_to` (Live Update Dynamic Label To).output-variables, 선언합니다.condition: state: RELEASE_TYPE == "OTA", 그리고 나중에 branchcondition) - CircleCI —
whenCircleCIifCircleCI는 config-compile 시간에 평가되므로 런타임 셸을 branch 하세요.when - Jenkins Jenkins에서는 stdout을 env 변수에 저장하고 사용하세요.
when { environment name: 'RELEASE_TYPE', value: 'OTA' }
경로 필터링 (선택적 속도 향상)
Section titled “필터 (선택적 속도 향상)””필터는 비용 최적화이며 Capgo 검사 대체가 아님. docs-only 경로를 제외하는 것을 선호하는 것이 좋습니다. 웹 빌드도 프레임워크 구성 파일에 의존하기 때문입니다: vite.config.*, tsconfig*.json, 및 프레임워크 구성 파일:
on: push: branches: [main] paths-ignore: - '**.md' - 'docs/**' - '.github/**'만약 허용 목록을 사용한다면, 웹 및 네이티브 빌드가 읽는 모든 입력을 포함해야 합니다. 단순히 src/ 및 package.json.
페이지/영역: Capgo 마케팅 웹사이트. 역할: 짧은 UI 레이블 또는 네비게이션 아이템. 페이지 trust.astro에서 볼 수 있음. 메시지 키 `and` (And).
네이티브 판결 후Section titled “네이티브 판결 후””
- Capgo 빌드가 signed binaries를 생성하고 TestFlight / Play로 제출할 수 있습니다. (참조) configuration).
- 구성
--auto-min-update-version(metadata strategy) 이 채널은 새로운 네이티브 패키지를 기록하기 때문에 — 그렇지 않으면 다음 JS-만의 커밋은 여전히native. - 사용자가 새로운 바이너리를 설치한 후, 이후 자바스크립트만의 커밋은 다시
OTA다시.