name: Publish Helm Chart
on:
  workflow_dispatch:
  push:
    tags: ["helm/chart/v**"]

jobs:
  publish:
    runs-on: ubuntu-latest
    # only run this on push events, not in PRs
    if: github.event_name == 'push' && github.repository == 'dagger/dagger'
    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-go@v3
        with:
          go-version: "1.21"

      - name: "Publish Helm Chart"
        run: ./hack/make helm:publish ${{ github.ref_name }}
        env:
          GITHUB_TOKEN: ${{ secrets.RELEASE_DAGGER_CI_TOKEN }}
          DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}
