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 || true
48 sudo rm -rf /root/.cache/snapcraft || true
49 sudo rm -rf ~/.cache/snapcraft || true
50 mkdir -p /home/runner/.cache/snapcraft/download
51 mkdir -p /home/runner/.cache/snapcraft/stage-packages
52 chmod -R 755 /home/runner/.cache/snapcraft
53
54 - name: Run GoReleaser
55 if: steps.tag_version.outputs.new_tag
56 uses: goreleaser/goreleaser-action@v5
57 with:
58 version: latest
59 args: release --clean
60 env:
61 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
63 SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}