1name: Release
2
3on:
4 workflow_dispatch:
5
6permissions:
7 contents: write # to create releases, tags and upload assets
8 pull-requests: read # to read pull request titles and labels for changelog
9 id-token: write # to sign the release
10
11jobs:
12 goreleaser:
13 runs-on: macos-latest
14 steps:
15 - name: Checkout
16 uses: actions/checkout@v6
17 with:
18 fetch-depth: 0
19
20 - name: Set up Go
21 uses: actions/setup-go@v6
22 with:
23 go-version: "1.26.1"
24
25 - name: Set up Zig
26 uses: goto-bus-stop/setup-zig@v2
27
28 - name: Bump version and push tag
29 id: tag_version
30 uses: mathieudutour/github-tag-action@v6.2
31 with:
32 github_token: ${{ secrets.GITHUB_TOKEN }}
33
34 - name: Fetch the new tag
35 run: git fetch --tags
36 env:
37 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
39 - name: Get macOS SDK path
40 id: macos_sdk
41 run: echo "path=$(xcrun --show-sdk-path)" >> $GITHUB_OUTPUT
42
43 - name: Run GoReleaser
44 if: steps.tag_version.outputs.new_tag
45 uses: goreleaser/goreleaser-action@v7
46 with:
47 version: latest
48 args: release --clean
49 env:
50 SDK_PATH: ${{ steps.macos_sdk.outputs.path }}
51 GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
52 HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
53
54 snapcraft:
55 runs-on: ubuntu-latest
56 needs: goreleaser
57 steps:
58 - name: Checkout
59 uses: actions/checkout@v6
60 with:
61 fetch-depth: 0
62
63 - name: Set up Go
64 uses: actions/setup-go@v6
65 with:
66 go-version: "1.26.1"
67
68 - name: Install Snapcraft
69 run: sudo snap install snapcraft --classic
70
71 - name: Clean Snapcraft cache
72 run: |
73 sudo rm -rf /home/runner/.cache/snapcraft || true
74 sudo rm -rf /root/.cache/snapcraft || true
75 sudo rm -rf ~/.cache/snapcraft || true
76 mkdir -p /home/runner/.cache/snapcraft/download
77 mkdir -p /home/runner/.cache/snapcraft/stage-packages
78 chmod -R 755 /home/runner/.cache/snapcraft
79
80 - name: Build and publish snap
81 env:
82 SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
83 run: |
84 snapcraft pack --destructive-mode
85 snapcraft upload --release=stable *.snap