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

Github 자동 빌드 및 릴리즈 앱

Github 액션으로 무료로 CI/CD pipeline을 만들고 Ionic Capacitor JS 앱을 매번 메인으로 푸시할 때마다 배포하세요.

Martin Donadieu

Martin Donadieu

콘텐츠 마케터

Github 자동 빌드 및 릴리즈 앱

이 튜토리얼은 GitHub 호스팅에 초점을 맞추고 있지만 다른 CI/CD 플랫폼에 적응하기만 하면 다른 CI/CD 플랫폼에도 적용할 수 있습니다.

소개

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

커밋 규칙

먼저 커밋 규칙을 따라야 합니다. conventional commits` 이 명령은 버전 번호를 업그레이드하는 데 도움이 되는 도구를 이해하는 데 도움이 됩니다. 5분 만에 배울 수 있습니다.

Conventional commits

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.

이 파일이 없다고 걱정하지 마세요. 이 파일은 자동으로 생성됩니다.

이것을 작동시키기 위해 메인 branch의 모든 커밋에 대한 태그를 릴리즈하고 changelog 항목을 추가하는 첫 번째 __CAPGO_KEEP_0__ 액션을 만들야 합니다. 개인 접근 토큰 GitHub에 추가하세요. 비밀 으로 PERSONAL_ACCESS_TOKEN.

CI가 변경 로그를 제출할 수 있도록 하기 위해 이것이 필요합니다.

토큰을 생성할 때 만료 기간을 never 및 범위로 repo.

마지막으로, __CAPGO_KEEP_0__ 파일의 버전을 설정하세요. Native 버전 번호와 일치시켜 다음 단계를 facilite 하세요. package.json 이것은 첫 번째 경우에만 필요합니다. 그 후 도구가 최신 상태를 유지할 것입니다.

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

GitHub

Both native and web platform will have the version number bump after each commit.

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으로 전송합니다.

빌드 명령이 다르다면, __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 GitHub에 커밋하면 프로덕션 채널에 새로운 빌드를 생성합니다. __CAPGO_KEEP_0__ CAPGO_TOKEN.

You can now commit this both files and see your first tag appear in GitHub!

__CAPGO_KEEP_0__

You should add your test in the build step to ensure your code is working.

Go to your Capgo dashboard and check your build who just appeared, you now have your CI/CD system.

If you want to let all of your users get the update whenever it’s available, go to your channel and set it to public.

You can also add the native build of your Ionic Capacitor JavaScript app by following this tutorial 👇

Keep going from Github Automatic build and release app

If you are using __CAPGO_KEEP_0__ to plan CI/CD automation, connect it with __CAPGO_KEEP_0__ CI/CD Github CI/CD for the product workflow in Github CI/CD __CAPGO_KEEP_0__ Native Builds for the product workflow in __CAPGO_KEEP_0__ Native Builds Capgo Automatic build and release app with Capgo actions Capgo Automatic build and release app with Capgo actions Capgo CI/CD Capgo CI/CD Capgo 통합 제품 워크플로우에서 Capgo 통합을 위해 CI/CD 통합 CI/CD 통합 구현 세부 정보를 위해 GitHub 액션 통합 GitHub 액션 통합 구현 세부 정보를 위해

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

웹 레이어 버그가 생긴 경우, 앱 스토어 승인 대기 없이 Capgo를 통해 픽스를 배포하세요. 사용자는 배경에서 업데이트를 받으며, 네이티브 변경 사항은 일반적인 리뷰 경로를 유지합니다.

시작하기

블로그에서 최신 소식

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