From f53add7a13e8ea250a7b114909e4b6ea8fc0208c Mon Sep 17 00:00:00 2001 From: Ilya Andreev <18560147+andreev-io@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:41:59 +0000 Subject: [PATCH] chart-releaser --- .github/workflows/kubenetmon.yaml | 77 +++++++++++-------------------- 1 file changed, 27 insertions(+), 50 deletions(-) diff --git a/.github/workflows/kubenetmon.yaml b/.github/workflows/kubenetmon.yaml index b3aa57a..12c6bef 100644 --- a/.github/workflows/kubenetmon.yaml +++ b/.github/workflows/kubenetmon.yaml @@ -214,56 +214,33 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Install Helm - uses: azure/setup-helm@v4 - - - name: Generate Version - id: version + # - name: Install Helm + # uses: azure/setup-helm@v4 + + # - name: Generate Version + # id: version + # run: | + # # Use short commit SHA as the version + # VERSION="0.1.0-$(git rev-parse --short HEAD)" + # echo "VERSION=$VERSION" >> $GITHUB_ENV + + # - name: Update chart version + # run: | + # for chart in deploy/helm/kubenetmon-agent deploy/helm/kubenetmon-server; do + # sed -i "s/^version:.*/version: $VERSION/" $chart/Chart.yaml + # sed -i "s/^appVersion:.*/appVersion: $VERSION/" $chart/Chart.yaml + # done + + - name: Configure Git run: | - # Use short commit SHA as the version - VERSION="0.1.0-$(git rev-parse --short HEAD)" - echo "VERSION=$VERSION" >> $GITHUB_ENV + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.7.0 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Update chart version - run: | - for chart in deploy/helm/kubenetmon-agent deploy/helm/kubenetmon-server; do - sed -i "s/^version:.*/version: $VERSION/" $chart/Chart.yaml - sed -i "s/^appVersion:.*/appVersion: $VERSION/" $chart/Chart.yaml - done - - - name: Package Helm charts - run: | - mkdir -p .cr-release-packages - for chart in deploy/helm/kubenetmon-agent deploy/helm/kubenetmon-server; do - helm package $chart --destination .cr-release-packages - done - - - name: Upload Helm charts to GitHub Release - uses: softprops/action-gh-release@v2 - with: - files: .cr-release-packages/* - tag_name: latest - generate_release_notes: true - - - name: Install Skopeo - run: | - sudo apt-get update - sudo apt-get install -y skopeo - - - name: Push charts to GHCR - run: | - for chart in .cr-release-packages/*.tgz; do - CHART_NAME=$(helm show chart $chart | grep '^name:' | awk '{print $2}') - CHART_VERSION=$(helm show chart $chart | grep '^version:' | awk '{print $2}') - helm push $chart oci://ghcr.io/clickhouse/kubenetmon/charts - skopeo copy \ - oci://ghcr.io/clickhouse/kubenetmon/charts/$CHART_NAME:$CHART_VERSION \ - oci://ghcr.io/clickhouse/kubenetmon/charts/$CHART_NAME:latest - done + charts_dir: deploy/helm + mark_as_latest: true + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + CR_GENERATE_RELEASE_NOTES: true