1name: Release
2
3on:
4 workflow_run:
5 workflows: ["Go CI"]
6 types: [completed]
7 branches:
8 - master
9
10permissions:
11 contents: write # to create releases, tags and upload assets
12 pull-requests: read # to read pull request titles and labels for changelog
13 id-token: write # to sign the release
14
15jobs:
16 goreleaser:
17 runs-on: ubuntu-latest
18 steps:
19 - name: Checkout
20 uses: actions/checkout@v6
21 with:
22 # This is required to allow GoReleaser to fetch all tags
23 # to determine the next version number.
24 fetch-depth: 0
25
26 - name: Set up Go
27 uses: actions/setup-go@v6
28 with:
29 go-version: "1.25" # Match the Go version in go.mod
30
31 - name: Bump version and push tag
32 id: tag_version
33 uses: mathieudutour/github-tag-action@v6.1
34 with:
35 github_token: ${{ secrets.GITHUB_TOKEN }}
36
37 - name: Fetch the new tag
38 run: git fetch --tags
39 env:
40 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
42 - name: Install Snapcraft
43 run: sudo snap install snapcraft --classic
44
45 - name: Clean Snapcraft cache
46 run: |
47 sudo rm -rf /home/runner/.cache/snapcraft
48 sudo rm -rf /root/.cache/snapcraft || true
49
50 - name: Run GoReleaser
51 if: steps.tag_version.outputs.new_tag
52 uses: goreleaser/goreleaser-action@v5
53 with:
54 version: latest
55 args: release --clean
56 env:
57 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58 HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
59 SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}