name: Release Charts

on:
  push:
    branches:
      - main
    paths:
      - 'helm/garage-ui/**'
      - '!helm/garage-ui/README.md'

jobs:
  release:
    permissions:
      contents: write
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v6
        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: Set up Helm
        uses: azure/setup-helm@v4.3.1
        with:
          version: v3.19.3

      - name: Run chart-releaser
        uses: helm/chart-releaser-action@v1.7.0
        with:
          charts_dir: helm
        env:
          CR_TOKEN: "${{ secrets.HELM_RELEASE_TOKEN }}"