
name: Release

on:
  release:
    types: [created]

permissions:
  contents: write

jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Unshallow
        run: git fetch --prune --unshallow

      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version-file: 'go.mod'
          cache: true

      - name: Setup NodeJS
        uses: actions/setup-node@v3
        with:
          node-version: 16

      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v3.2.0
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
