name: Release Charts

on:
  push:
    branches:
      - master
      - release-*

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Configure Git
        run: |
          git config user.name "$GITHUB_ACTOR"
          git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

      - name: Fetch history
        run: git fetch --prune --unshallow

      - name: Add dependency chart repos
        run: |
          helm repo add stable https://kubernetes-charts.storage.googleapis.com/

      - name: Run chart-releaser
        uses: helm/chart-releaser-action@v1.0.0-rc.2
        env:
          CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
