release.yml

 1name: release
 2
 3on:
 4  workflow_dispatch:
 5  push:
 6    tags:
 7      - "*"
 8
 9concurrency: ${{ github.workflow }}-${{ github.ref }}
10
11permissions:
12  contents: write
13  packages: write
14
15jobs:
16  goreleaser:
17    runs-on: ubuntu-latest
18    steps:
19      - uses: actions/checkout@v3
20        with:
21          fetch-depth: 0
22
23      - run: git fetch --force --tags
24
25      - uses: actions/setup-go@v5
26        with:
27          go-version: ">=1.23.2"
28          cache: true
29          cache-dependency-path: go.sum
30
31      - run: go mod download
32      
33      - name: Restore GoReleaser build cache
34        uses: actions/cache@v3
35        with:
36          path: |
37            ~/.cache/go-build
38            dist/
39            .goreleaser.cache
40          key: ${{ runner.os }}-go-build-${{ hashFiles('**/*.go') }}-${{ hashFiles('go.sum') }}
41          restore-keys: |
42            ${{ runner.os }}-go-build-
43      
44      - uses: goreleaser/goreleaser-action@v6
45        with:
46          distribution: goreleaser
47          version: latest
48          args: release --clean
49        env:
50          GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
51          AUR_KEY: ${{ secrets.AUR_KEY }}