name: goreleaser

on:
  push:
    tags:
      - 'v*.*.*'

permissions:
  contents: write

jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      -
        name: checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      -
        name: set up Go
        uses: actions/setup-go@v3
        with:
          go-version: 1.19
      -
        name: set up CycloneDX
        uses: CycloneDX/gh-gomod-generate-sbom@v1
        with:
          version: v1
      -
        name: run GoReleaser
        uses: goreleaser/goreleaser-action@v4
        with:
          distribution: goreleaser
          version: latest
          args: release --clean
        env:
          GITHUB_TOKEN: ${{ secrets.AMASS_TOKEN }}
          HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
