Vectrum
Sign In
36 lines · 878 Bytes
name: release

on:
  push:
    tags: ["v*"]

permissions:
  # Creating the GitHub release and uploading its archives.
  contents: write

jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          # The changelog is the commits since the previous tag, and a
          # shallow clone has neither.
          fetch-depth: 0

      - uses: actions/setup-go@v6
        with:
          go-version-file: go.mod

      # A tag is cut from a commit CI has usually already passed, but not
      # necessarily: this is the last chance to not publish a broken build.
      - name: test
        run: go test ./...

      - uses: goreleaser/goreleaser-action@v6
        with:
          distribution: goreleaser
          version: "~> v2"
          args: release --clean
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}