name: Release
# This workflow helps with creating releases.
# This job will only be triggered when a tag (vX.X.x) is pushed
on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Go
        uses: actions/setup-go@v2.1.3
        with:
          go-version: 1.16
      - name: Unshallow
        run: git fetch --prune --unshallow
      - name: Create release
        uses: goreleaser/goreleaser-action@v2.7.0
        with:
          args: release --rm-dist --release-notes ./RELEASE_CHANGELOG.md
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
