GitHub 액션 통합
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
Integrate Capgo Live Updates with GitHub Actions to automatically deploy your app updates whenever you push code changes. This guide covers setting up automated builds, testing, and deployment workflows using GitHub’s powerful CI/CD platform.
__CAPGO_KEEP_0__ Actions 통합을 설정하기 전에 확인해야 하는 필수 조건입니다.
설정하기GitHub repository에 앱의 소스 __CAPGO_KEEP_1__가 포함되어 있어야 합니다.
- A GitHub repository with your app’s source code
- Capgo
- Node.js 및 npm/yarn이 프로젝트에 구성되었습니다.
- GitHub Actions가 저장소에 활성화되었습니다.
GitHub 비밀을 설정하는 방법
제목 "GitHub 비밀을 설정하는 방법"1단계: 저장소 비밀을 구성합니다.
제목 "1단계: 저장소 비밀을 구성합니다."GitHub 저장소에 필요한 비밀을 설정하세요:
- GitHub 저장소로 이동하세요.
- 가장자리 설정 → 비밀 및 변수 → 액션
- 클릭 새로운 저장소 비밀 그리고 다음을 추가하세요:
| 비밀 이름 | 값 |
|---|---|
CAPGO_TOKEN | Capgo API 토큰 |
간단한 프로덕션 배포
간단한 프로덕션 배포기본적인 구성으로 시작하여 메인 branch로 푸시될 때마다 프로덕션으로 배포하세요.
# Simple GitHub Actions Workflow for Capgo Live Updatesname: Deploy to Capgo
on: push: branches: - main
jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6
- name: Setup Node.js uses: actions/setup-node@v6 with: node-version: '24' cache: 'npm'
- name: Install, test and build run: | npm ci npm run test npm run build
- name: Deploy to Capgo run: | npm install -g @capgo/cli npx @capgo/cli bundle upload --channel production env: CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }} # For encrypted uploads, add: --key-data-v2 "${{ secrets.CAPGO_PRIVATE_KEY }}"고급 멀티 채널 구성
고급 멀티 채널 구성기능 branch 배포
기능 branch 배포기능 branch를 임시 채널로 테스트하기 위해 배포하세요.
# Feature branch deploymentname: Deploy Feature Branch to Capgo
on: push: branches: - 'feature/**'
jobs: deploy-feature: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v6 with: node-version: '24' cache: 'npm'
- run: | npm ci npm run test npm run build
- name: Deploy to feature channel run: | CHANNEL_NAME=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]') npm install -g @capgo/cli npx @capgo/cli channel create $CHANNEL_NAME --apikey ${{ secrets.CAPGO_TOKEN }} || true npx @capgo/cli bundle upload --apikey ${{ secrets.CAPGO_TOKEN }} --channel $CHANNEL_NAME암호화 사용
암호화 사용만약 __CAPGO_KEEP_0__의 암호화 기능을 사용 중이라면 Capgo의 암호화 기능을 사용 중이라면당신은 CI/CD 환경에서 개인 키를 안전하게 저장해야 합니다.
설정 후 __CAPGO_KEEP_0__에서 암호화 키를 설정한 후 개인 키를 GitHub의 비밀 키로 저장하세요:
# Display your private key content (copy this output)cat .capgo_key_v2__CAPGO_KEEP_0__ 저장소 비밀 키로 저장 후 워크플로우에서 사용하세요: CAPGO_PRIVATE_KEY in your GitHub repository secrets, then use it in workflows:
# Deploy with encryption- name: Deploy to Capgo with Encryption run: | npm install -g @capgo/cli npx @capgo/cli bundle upload --apikey ${{ secrets.CAPGO_TOKEN }} --key-data-v2 "${{ secrets.CAPGO_PRIVATE_KEY }}" --channel production다중 채널 구성
다중 채널 구성 섹션다중 채널을 설정하고 관리하는 방법에 대한 자세한 정보는 채널 문서를 참조하세요 개발, pull request, 및 프로덕션 배포와 같은 완전한 워크플로우:.
복사하기
# Complete multi-environment workflowname: Deploy to Capgo
on: push: branches: [main, develop] pull_request: branches: [main, develop]
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v6 with: node-version: '24' cache: 'npm'
- run: | npm ci npm run test npm run build
- uses: actions/upload-artifact@v6 with: name: dist path: dist/
deploy-development: if: github.ref == 'refs/heads/develop' needs: build runs-on: ubuntu-latest environment: development steps: - uses: actions/setup-node@v6 with: node-version: '24'
- uses: actions/download-artifact@v4 with: name: dist path: dist/
- run: | npm install -g @capgo/cli npx @capgo/cli bundle upload --apikey ${{ secrets.CAPGO_TOKEN }} --channel development
deploy-pr: if: github.event_name == 'pull_request' needs: build runs-on: ubuntu-latest steps: - uses: actions/setup-node@v6 with: node-version: '24'
- uses: actions/download-artifact@v4 with: name: dist path: dist/
- name: Deploy to PR channel run: | CHANNEL_NAME="pr-${{ github.event.number }}" npm install -g @capgo/cli npx @capgo/cli channel create $CHANNEL_NAME --apikey ${{ secrets.CAPGO_TOKEN }} || true npx @capgo/cli bundle upload --apikey ${{ secrets.CAPGO_TOKEN }} --channel $CHANNEL_NAME
- name: Comment PR uses: actions/github-script@v7 with: script: | github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: `🚀 This PR has been deployed to Capgo channel: \`pr-${{ github.event.number }}\`\n\nTo test this update in your app, configure it to use this channel. [Learn how to configure channels →](/docs/live-updates/channels/#configuring-the-channel-in-your-app)` })
deploy-production: if: github.ref == 'refs/heads/main' needs: build runs-on: ubuntu-latest environment: production steps: - uses: actions/setup-node@v6 with: node-version: '24'
- uses: actions/download-artifact@v4 with: name: dist path: dist/
- run: | npm install -g @capgo/cli npx @capgo/cli bundle upload --apikey ${{ secrets.CAPGO_TOKEN }} --channel production기능 채널 정리
기능 채널을 삭제할 때 자동으로 정리하는 기능:클립보드에 복사
name: Cleanup Feature Channels
on: delete:
jobs: cleanup: runs-on: ubuntu-latest if: github.event.ref_type == 'branch' && startsWith(github.event.ref, 'feature/') steps: - uses: actions/setup-node@v6 with: node-version: '24'
- name: Delete Capgo channel run: | CHANNEL_NAME=$(echo "${{ github.event.ref }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]') npm install -g @capgo/cli npx @capgo/cli channel delete $CHANNEL_NAME --apikey ${{ secrets.CAPGO_TOKEN }} || true기능 채널 정리
환경 보호 규칙Environment Protection Rules
Section titled “Environment Protection Rules”GitHub에서 환경 보호 규칙을 설정하세요:
- 가장 먼저 설정 → 환경 원본 저장소
- 환경을 생성하세요:
development,staging,production - 생산 환경을 위한:
- 필수 검토자: 배포를 승인해야 하는 팀원들을 추가하세요
- 대기 시간: 배포 전 지연 시간을 추가하세요 (선택사항)
- 배포 branch: 한정
mainbranch만
보안 비밀 관리
제목 ‘보안 비밀 관리’환경에 따라 비밀을 사용하세요:
# Use different secrets per environmentdeploy-production: environment: production steps: - name: Deploy to Production run: | npx @capgo/cli bundle upload \ --apikey ${{ secrets.CAPGO_PROD_TOKEN }} \ --app ${{ secrets.CAPGO_PROD_APP_ID }} \ --channel production모니터링 및 알림
제목 ‘모니터링 및 알림’슬랙 통합
제목 ‘슬랙 통합’워크플로에 슬랙 알림을 추가하세요:
name: Deploy with Notifications
jobs: deploy: runs-on: ubuntu-latest steps: # ... deployment steps
- name: Notify Slack on Success if: success() uses: 8398a7/action-slack@v3 with: status: success text: '✅ Capgo deployment successful!' fields: repo,message,commit,author,action,eventName,ref,workflow env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure if: failure() uses: 8398a7/action-slack@v3 with: status: failure text: '❌ Capgo deployment failed!' fields: repo,message,commit,author,action,eventName,ref,workflow env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}디스코드 통합
디스코드 통합 섹션디스코드로 알림을 보냅니다:
- name: Discord notification if: always() uses: Ilshidur/action-discord@master with: args: | Capgo deployment ${{ job.status }}! App: ${{ secrets.CAPGO_APP_ID }} Channel: ${{ github.ref_name }} Commit: ${{ github.sha }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}이메일 알림
이메일 알림 섹션이메일 알림을 구성합니다:
- name: Send email notification if: failure() uses: dawidd6/action-send-mail@v3 with: server_address: smtp.gmail.com server_port: 465 username: ${{ secrets.EMAIL_USERNAME }} password: ${{ secrets.EMAIL_PASSWORD }} subject: 'Capgo Deployment Failed - ${{ github.repository }}' to: team@yourcompany.com from: ci-cd@yourcompany.com body: | Deployment failed for ${{ github.repository }} Branch: ${{ github.ref_name }} Commit: ${{ github.sha }} Workflow: ${{ github.workflow }}문제 해결
문제 해결 섹션워크플로우 디버그
Debug Workflow문제를 해결하기 위해 디버깅 단계를 추가하세요:
- name: Debug environment run: | echo "Node version: $(node --version)" echo "NPM version: $(npm --version)" echo "Working directory: $(pwd)" echo "Files in dist/: $(ls -la dist/ || echo 'No dist directory')" echo "Environment variables:" env | grep -E "(GITHUB_|CAPGO_)" | sort
- name: Test Capgo CLI run: | npx @capgo/cli --version npx @capgo/cli app debug --apikey ${{ secrets.CAPGO_TOKEN }} --app ${{ secrets.CAPGO_APP_ID }}일반적인 문제와 해결책
일반적인 문제와 해결책“CAPGO_TOKEN not found” 오류로 인해 워크플로가 실패합니다:
- name: Verify secrets run: | if [ -z "${{ secrets.CAPGO_TOKEN }}" ]; then echo "ERROR: CAPGO_TOKEN secret is not set" exit 1 fi echo "CAPGO_TOKEN is set (length: ${#CAPGO_TOKEN})" env: CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}빌드 아티팩트가 없습니다:
- name: Debug artifacts run: | echo "Checking for build artifacts..." ls -la dist/ || echo "No dist directory found" find . -name "*.js" -o -name "*.html" | head -10네트워크 연결 문제:
- name: Test connectivity run: | ping -c 3 api.capgo.io || echo "Ping failed" curl -I https://api.capgo.io/health || echo "Health check failed"재사용 가능한 워크플로
재사용 가능한 워크플로우프로젝트 간 일관성을 위해 재사용 가능한 워크플로우를 생성하세요:
name: Reusable Capgo Deploy
on: workflow_call: inputs: environment: required: true type: string channel: required: true type: string secrets: CAPGO_TOKEN: required: true CAPGO_APP_ID: required: true
jobs: deploy: runs-on: ubuntu-latest environment: ${{ inputs.environment }} steps: - uses: actions/checkout@v6
- name: Setup Node.js uses: actions/setup-node@v6 with: node-version: '24' cache: 'npm'
- name: Install and build run: | npm ci npm run build
- name: Deploy to Capgo run: | npm install -g @capgo/cli npx @capgo/cli bundle upload \ --apikey ${{ secrets.CAPGO_TOKEN }} \ --app ${{ secrets.CAPGO_APP_ID }} \ --channel ${{ inputs.channel }}__CAPGO_KEEP_0__/workflows/deploy.yml
name: Deploy App
on: push: branches: [main, develop]
jobs: deploy-dev: if: github.ref == 'refs/heads/develop' uses: ./.github/workflows/reusable-capgo-deploy.yml with: environment: development channel: development secrets: CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }} CAPGO_APP_ID: ${{ secrets.CAPGO_APP_ID }}
deploy-prod: if: github.ref == 'refs/heads/main' uses: ./.github/workflows/reusable-capgo-deploy.yml with: environment: production channel: production secrets: CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }} CAPGO_APP_ID: ${{ secrets.CAPGO_APP_ID }}다음 단계
채널- 다양한 배포 환경을 관리하기 위해 채널을 사용하세요 다음 단계 다음 단계
- 탐색 고급 배포 시나리오를 위해 사용하는 Custom Storage 고급 배포 시나리오를 위해
- 설정 보안 배포를 위해 사용하는 Encryption 보안 배포를 위해
- 설정 업데이트 동작을 설정하여 업데이트가 적용되는 방식을 커스터마이즈하세요 __CAPGO_KEEP_0__ Actions 통합을 사용하면 __CAPGO_KEEP_1__의 강력한 CI/CD 플랫폼을 활용하여 __CAPGO_KEEP_2__ Live Updates에 내장된 보안, 모니터링 및 협업 기능을 포함한 정교한 배포 워크플로우를 생성할 수 있습니다.
With GitHub Actions integration, you can leverage GitHub’s powerful CI/CD platform to create sophisticated deployment workflows with built-in security, monitoring, and collaboration features for your Capgo Live Updates.
GitHub Actions Integration에서 계속 진행하는 방법
Section titled “Keep going from GitHub Actions Integration”만약에 __CAPGO_KEEP_0__ 사용 중이라면 GitHub 액션 통합 __CAPGO_KEEP_0__와 연결하여 Capgo CI/CD Capgo CI/CD에서 제품 워크플로우 Capgo 네이티브 빌드 Capgo 네이티브 빌드에서 제품 워크플로우 Capgo Capgo CI/CD에서 제품 워크플로우 CI/CD 통합 CI/CD 통합 구현 세부 사항 GitLab CI/CD 통합 GitLab CI/CD Integration에 대한 구현 세부 정보입니다.