name: Release Helm Charts

on:
  push:
    paths:
      - 'charts/**'

permissions:
  contents: write

jobs:
  release-helm-charts:
    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 "$GITHUB_ACTOR@users.noreply.github.com"

      - name: Install helm
        uses: azure/setup-helm@v3

      - name: Release charts
        uses: helm/chart-releaser-action@v1.6.0
        env:
          CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        with:
          skip_existing: true
          mark_as_latest: false
          config: charts/release-config.yaml
