메인 콘텐츠로 바로가기
CI/CD

Gitlab을 사용하여 자동 빌드 및 릴리스

Gitlab을 무료로 사용하여 자신의 CI/CD pipeline을 만들고 main으로 푸시할 때마다 앱을 배포하세요.

마틴 도나디유

마틴 도나디유

콘텐츠 마케터

Gitlab을 사용하여 자동 빌드 및 릴리스

이 튜토리얼은 GitLab CI에 초점을 맞추고 있지만 다른 CI/CD 플랫폼에 적응하기 위해 약간의 조정을 통해 사용할 수 있습니다.

소개

Capgo에 앱을 먼저 추가하십시오. 이 튜토리얼은 업로드 단계만 다룹니다.

커밋 규칙

커밋 규칙을 따르기 시작해야 합니다. conventional commits`이것은 버전 번호를 업그레이드하는 방법을 이해하는 도구를 도와주므로 5분 만에 배울 수 있습니다.`

Conventional commits

GitLab CI for tag

그런 다음 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

__CAPGO_KEEP_0__ CHANGELOG.md.

__CAPGO_KEEP_0__

__CAPGO_KEEP_0__ 개인 접근 토큰 __CAPGO_KEEP_0__ PERSONAL_ACCESS_TOKEN.

__CAPGO_KEEP_0__

__CAPGO_KEEP_0__ never __CAPGO_KEEP_0__ repo.

__CAPGO_KEEP_0__ .cz.toml __CAPGO_KEEP_0__

__CAPGO_KEEP_0__

[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_0__ package.json 파일.

이것은 처음 한 번만 필요합니다. 그 후에는 도구가 최신 상태로 유지합니다.

GitHub에 첫 번째 태그가 나타날 수 있도록 두 개의 파일을 모두 커밋할 수 있습니다.

GitHub 빌드 액션

__CAPGO_KEEP_0__ 경로에 파일을 생성하세요: .github/workflows/build.yml

__CAPGO_KEEP_2__:

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__에서 "step" 섹션을 수정하세요. build_code __CAPGO_KEEP_0__ 키를 __CAPGO_KEEP_1__에서 가져와 __CAPGO_KEEP_0__의 비밀을 __CAPGO_KEEP_0__ 저장소의 "secret" 섹션에 추가하세요.

To make this work, you need to get your API key for Capgo, add it in the secret of your GitHub repository You can now commit this both files and see your first tag appear in __CAPGO_KEEP_0__! CAPGO_TOKEN.

GitHub에서 두 개의 파일을 커밋하고 첫 번째 태그가 나타날 수 있습니다!

생산 채널에 새로운 빌드를 생성하기 위해 커밋을 추가합니다.

빌드 단계에서 code이 작동하는지 확인하기 위해 테스트를 추가해야 합니다.

Capgo 대시보드로 가서 최근에 생성된 빌드를 확인하세요. 이제 CI/CD 시스템을 갖추었습니다.

업데이트가 언제든지 사용할 수 있도록 하려면, 채널로 가서 public.

자동 빌드 및 릴리즈와 Gitlab

자동 빌드 및 릴리즈와 Gitlab 를 사용하는 경우, CI/CD 자동화 계획을 위해 __CAPGO_KEEP_0__ CI/CD Capgo CI/CD에서 제품 워크플로우를 위해 Capgo Native Builds Capgo CI/CD for the product workflow in Capgo Native Builds, Capgo 통합 Capgo 통합 CI/CD 통합 CI/CD 통합 구현 세부 사항, 및 GitHub 액션 통합 GitHub 액션 통합 구현 세부 사항.

Capacitor 앱에 대한 실시간 업데이트

웹层 버그가 활성화되면 Capgo을 통해 앱 스토어 승인까지의 몇 일간의 기다림 없이修정 패치를 배포하세요. 사용자는 배경에서 업데이트를 받으면서 네이티브 변경은 일반적인 리뷰 경로를 유지합니다.

시작하기

블로그에서 최신 뉴스

Capgo은 전문적인 모바일 앱을 만들기 위해 필요한 최고의洞察력을 제공합니다.