Gitlab을 사용하여 자동 빌드 및 릴리즈
이 튜토리얼은 GitLab CI에 초점을 맞추고 있지만 다른 CI/CD 플랫폼에适용하기 위해 약간의 조정을 하면 다른 CI/CD 플랫폼에도 적용할 수 있습니다.
Be sure you added your app first to Capgo, this tutorial just focuses on the upload phase
앱을 __CAPGO_KEEP_0__에 먼저 추가하셨는지 확인하세요. 이 튜토리얼은 업로드 단계만 다룹니다.
커밋 규칙 커밋 규칙을 따라야 합니다. 첫 번째로 커밋 규칙을 따라야 합니다. 전통적인 커밋` 이 도구가 버전 번호를 업그레이드하는 방법을 이해하도록 도와줄 것입니다. 그것은 5분 만에 배울 수 있습니다.

태그를위한 GitLab CI
그런 다음 당신은 자동으로 빌드하고 태그를 생성하기위한 첫 번째 GitLab을 만들 필요가 있습니다.
이 경로에 파일을 만들려면: .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.
이 파일이 없다고 걱정하지 마세요. 그것은 당신에게 만들어질 것입니다.
이것이 작동하기위해, GitLab CI/CD 변수에 이것은 CI가 changelog를 커밋할 수 있도록 허용하기위한 것입니다. PERSONAL ACCESS TOKEN PERSONAL_ACCESS_TOKEN.
This is necessary to let the CI commit the changelog.
When you create the token, choose expiration as __CAPGO_KEEP_0__ and the scope as __CAPGO_KEEP_1__ never __CAPGO_KEEP_2__ repo.
__CAPGO_KEEP_3__ .cz.toml __CAPGO_KEEP_4__
__CAPGO_KEEP_5__
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "$major.$minor.$patch$prerelease"
version = "0.11.5"
version_files = [
"package.json:version",
".cz.toml"
]
__CAPGO_KEEP_6__ package.json __CAPGO_KEEP_7__
__CAPGO_KEEP_8__
You can now commit this both files and see your first tag appear in GitHub!
GitHub actions for build
__CAPGO_KEEP_11__ .github/workflows/build.yml
__CAPGO_KEEP_12__
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__의 비밀을 __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_0__이 작동하는지 확인하기 위해, 빌드 단계에 테스트를 추가해야 합니다. CAPGO_TOKEN.
GitHub 대시보드로 가서, 빌드가 나타났는지 확인하세요. 이제 CI/CD 시스템이 준비되었습니다.
모든 사용자가 업데이트를 받을 수 있도록 하려면, 채널을 __CAPGO_KEEP_0__로 설정하세요.
You should add your test in the build step to ensure your code is working.
Capgo으로 Capgo 키를 추가하세요.
__CAPGO_KEEP_0__에 __CAPGO_KEEP_0__ 키를 추가하세요. public.
__CAPGO_KEEP_0__에 __CAPGO_KEEP_0__ 키를 추가하세요.
만약에 __CAPGO_KEEP_0__을 사용하고 있다면 Gitlab과 자동으로 빌드 및 릴리즈를 진행할 수 있습니다. __CAPGO_KEEP_0__ CI/CD와 연결하여 Capgo CI/CD의 제품 워크플로우에서 Capgo Native Builds의 제품 워크플로우에서 Capgo Integrations의 제품 워크플로우에서 for the product workflow in Capgo Native Builds, Capgo Integrations Capgo Actions Integration __CAPGO_KEEP_0__ CI/CD __CAPGO_KEEP_0__ Native Builds GitHub Integrations GitHub 액션 통합 구현 세부 사항에 대해.