From 997216f4bb9173a9f5fa83b2ca542bc05832f9a6 Mon Sep 17 00:00:00 2001 From: Enrico Candino Date: Tue, 4 Feb 2025 09:17:27 +0100 Subject: [PATCH] chart-releaser action (#222) --- .cr.yaml | 1 + .github/workflows/chart.yml | 41 +++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 .cr.yaml diff --git a/.cr.yaml b/.cr.yaml new file mode 100644 index 00000000..7d70edb6 --- /dev/null +++ b/.cr.yaml @@ -0,0 +1 @@ +release-name-template: chart-{{ .Version }} diff --git a/.github/workflows/chart.yml b/.github/workflows/chart.yml index 9a4d8843..af52b427 100644 --- a/.github/workflows/chart.yml +++ b/.github/workflows/chart.yml @@ -1,30 +1,45 @@ +name: Chart + on: + workflow_dispatch: push: tags: - "chart-*" -env: - GITHUB_TOKEN: ${{ github.token }} - -name: Chart permissions: contents: write - id-token: write + jobs: chart-release: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Package Chart + - name: Check tag + if: github.event_name == 'push' run: | - make package-chart; + pushed_tag=$(echo ${{ github.ref_name }} | sed "s/chart-//") + chart_tag=$(yq .version charts/k3k/Chart.yaml) + + echo pushed_tag=${pushed_tag} chart_tag=${chart_tag} + [ "${pushed_tag}" == "${chart_tag}" ] - - name: Release Chart - run: | - gh release upload ${{ github.ref_name }} deploy/* - - - name: Index Chart + - name: Configure Git run: | - make index-chart + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v4 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + with: + config: .cr.yaml + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"