GitHub 호스팅에 초점을 맞춘 이 튜토리얼은 다른 CI/CD 플랫폼에도 쉽게 적응할 수 있습니다.
소개
Capacitor 앱을 Capgo에 먼저 추가하십시오. 이 튜토리얼은 업로드 단계만 다룹니다. Capgo에 앱을 추가해야 하는 경우에는 이 튜토리얼
커밋 규칙
먼저 커밋 규칙을 따라야 합니다. conventional commits` 이 규칙을 따라야 tooling이 버전 번호를 업그레이드하는 방법을 이해할 수 있습니다. 5분 만에 배울 수 있습니다.

GitHub 태그에 대한 액션
그 다음에 자동으로 빌드하고 태그를 생성하는 첫 번째 GitHub 액션을 만들야 합니다.
파일을 다음 경로에 만들세요: .github/workflows/bump_version.yml
이 내용으로:
name: Bump version
on:
push:
branches:
- main
jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with standard version"
steps:
- name: Check out
uses: actions/checkout@v6
with:
fetch-depth: 0
filter: blob:none
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
- name: Git config
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
- name: Create bump and changelog
run: npx capacitor-standard-version
- name: Push to origin
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git pull $remote_repo $CURRENT_BRANCH
git push $remote_repo HEAD:$CURRENT_BRANCH --follow-tags --tags
이것은 메인 branch의 모든 커밋에 대해 태그를 릴리즈하고 메인 branch의 모든 커밋에 대한 changelog 항목을 추가합니다. CHANGELOG.md.
이 파일이 없다고 걱정하지 마세요. 이 파일은 자동으로 생성됩니다.
이것을 작동시키기 위해... 개인 접근 토큰 GitHub에 추가하세요 비밀 및 PERSONAL_ACCESS_TOKEN.
CI가 변경 로그를 제출할 수 있도록 하기 위해 필요합니다.
토큰을 생성할 때 만료 기간을 never 및 repo.
범위 package.json 마지막으로,
__CAPGO_KEEP_0__ 파일에서 버전을 설정하고, Native 버전 번호와 일치시킨 다음 다음 단계로 진행하세요.
You can now commit this both files and see your first tag appear in GitHub!
native 및 웹 플랫폼 모두 각 커밋마다 버전 번호를 업데이트합니다.
GitHub 빌드에 대한 액션
다음 경로에 파일을 생성하세요: .github/workflows/build.yml
내용:
name: Build source code and send to Capgo
on:
push:
tags:
- '*'
jobs:
deploy:
runs-on: ubuntu-latest
name: "Build code and release"
steps:
- name: Check out
uses: actions/checkout@v6
- name: Install dependencies
id: install_code
run: npm i
- name: Build
id: build_code
run: npm run build
env: # Remove both lines if you don't need it
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} # Example of env var coming from a secret
- name: Create Release
id: create_release
run: npx @capgo/cli@latest bundle upload -a ${{ secrets.CAPGO_TOKEN }} -c production
Capgo으로 전송하기 전에 의존성을 설치하고 빌드하는 데 사용됩니다.
빌드 명령이 다르다면, __CAPGO_KEEP_0__에서 변경할 수 있습니다. build_code 이 작업을 완료하려면 __CAPGO_KEEP_1__의 __CAPGO_KEEP_0__ 키를 가져와 __CAPGO_KEEP_0__ 저장소의 비밀에 추가해야 합니다.
To make this work, you need to get your API key for Capgo, add it in the secret of your GitHub repository 이 작업을 완료하려면 __CAPGO_KEEP_1__의 __CAPGO_KEEP_0__ 키를 가져와 __CAPGO_KEEP_0__ 저장소의 비밀에 추가해야 합니다. CAPGO_TOKEN.
이제 두 개의 파일을 커밋하고 GitHub에서 첫 번째 태그가 나타날 수 있습니다!
커밋을 추가하면 프로덕션 채널에 새로운 빌드를 생성합니다.
당신의 테스트를 빌드 단계에 추가하여 code이 작동하는지 확인하세요.
Capgo 대시보드에 가서 최근에 생성된 빌드를 확인하세요. 이제 CI/CD 시스템이 준비되었습니다.
모든 사용자가 업데이트를 받을 수 있도록 하려면, 채널로 이동하여 업데이트를 활성화하세요. public.
Ionic Capacitor JavaScript 앱의 네이티브 빌드를 추가하려면 이 튜토리얼 👇을 따라하세요.