Chart Releaser Action으로 GitHub Page 차트 자동화

Chart Releaser Action으로 GitHub Page 차트 자동화

Chart Releaser Action을 사용해 GitHub pages를 통해 차트 릴리스를 자동화하는 방법에 대한 가이드입니다.

출처: 문서

본문

이 가이드는 Chart Releaser Action을 사용해 GitHub pages를 통해 차트 릴리스를 자동화하는 방법을 설명합니다. Chart Releaser Action은 helm/chart-releaser CLI 도구를 사용해 GitHub 프로젝트를 자체 호스팅 Helm 차트 리포지토리로 만드는 GitHub Action 워크플로입니다.

리포지토리 변경 사항 (Repository Changes)

GitHub 조직 아래에 Git 리포지토리를 만드세요. 리포지토리 이름을 helm-charts 로 지을 수 있으며, 다른 이름도 허용됩니다. 모든 차트의 소스는 main 브랜치 아래에 둘 수 있습니다. 차트는 디렉터리 트리의 최상위에 있는 /charts 디렉터리 아래에 배치해야 합니다.

차트를 게시할 gh-pages 라는 또 다른 브랜치가 있어야 합니다. 해당 브랜치의 변경 사항은 여기에 설명된 Chart Releaser Action이 자동으로 만듭니다. 다만 gh-pages 브랜치를 미리 만들고 README.md 파일을 추가할 수 있는데, 이 파일은 페이지를 방문하는 사용자에게 보입니다.

차트 설치에 대한 지침을 README.md에 다음과 같이 추가할 수 있습니다(<alias>, <orgname>, <chart-name>을 바꾸세요).

## Usage

[Helm](https://helm.sh) must be installed to use the charts.  Please refer to
Helm's [documentation](https://helm.sh/docs) to get started.

Once Helm has been set up correctly, add the repo as follows:

  helm repo add <alias> https://<orgname>.github.io/helm-charts

If you had already added this repo earlier, run `helm repo update` to retrieve
the latest versions of the packages.  You can then run `helm search repo
<alias>` to see the charts.

To install the <chart-name> chart:

    helm install my-<chart-name> <alias>/<chart-name>

To uninstall the chart:

    helm uninstall my-<chart-name>

차트는 다음과 같은 URL의 웹사이트에 게시됩니다.

    https://<orgname>.github.io/helm-charts

GitHub Actions 워크플로

main 브랜치의 .github/workflows/release.yml 에 GitHub Actions 워크플로 파일을 만드세요.

name: Release Charts

on:
  push:
    branches:
      - main

jobs:
  release:
    permissions:
      contents: write
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Configure Git
        run: |
          git config user.name "$GITHUB_ACTOR"
          git config user.email "[email protected]"

      - name: Run chart-releaser
        uses: helm/[email protected]
        env:
          CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

위 구성은 @helm/chart-releaser-action을 사용해 GitHub 프로젝트를 자체 호스팅 Helm 차트 리포지토리로 만듭니다. main 에 대한 모든 push 마다 프로젝트의 각 차트를 확인하고, 새 차트 버전이 있으면 차트 버전 이름의 GitHub 릴리스를 만들고, 해당 릴리스에 Helm 차트 아티팩트를 추가하며, 그 릴리스에 대한 메타데이터가 있는 index.yaml 파일을 만들거나 업데이트하고, 이를 GitHub pages 에 호스팅합니다.

위 예제에서 사용된 Chart Releaser Action 버전 번호는 v1.6.0 입니다. 사용 가능한 최신 버전으로 변경할 수 있습니다.

참고: Chart Releaser Action은 거의 항상 Helm Testing ActionKind Action과 함께 사용됩니다.

더 알아보기 (Learn more)