Skip to content

Commit b88e4e4

Browse files
fengyilyclaude
andcommitted
feat: enable system tray for macOS/Windows builds
Split goreleaser into 3 builds: - macOS: CGO_ENABLED=1 + withtray (systray needs Cocoa) - Windows: CGO_ENABLED=0 + withtray (systray uses pure Go syscalls) - Linux: CGO_ENABLED=0, no tray CI runner changed from ubuntu-latest to macos-latest for native darwin CGO support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0cb538d commit b88e4e4

2 files changed

Lines changed: 42 additions & 9 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818
jobs:
1919
release:
2020
name: GoReleaser
21-
runs-on: ubuntu-latest
21+
runs-on: macos-latest
2222
steps:
2323
- uses: actions/checkout@v4
2424
with:

‎.goreleaser.yaml‎

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,58 @@ version: 2
33
project_name: shield-cli
44

55
builds:
6-
- main: .
6+
# macOS: CGO required for systray (Cocoa framework)
7+
- id: macos
8+
main: .
79
binary: shield
10+
tags:
11+
- withtray
812
env:
9-
- CGO_ENABLED=0
13+
- CGO_ENABLED=1
1014
goos:
1115
- darwin
12-
- linux
16+
goarch:
17+
- amd64
18+
- arm64
19+
ldflags:
20+
- -s -w
21+
- -X shield-cli/cmd.Version={{.Version}}
22+
- -X shield-cli/cmd.GitCommit={{.Commit}}
23+
- -X shield-cli/cmd.BuildTime={{.Date}}
24+
25+
# Windows: systray uses pure Go syscalls, no CGO needed
26+
- id: windows
27+
main: .
28+
binary: shield
29+
tags:
30+
- withtray
31+
env:
32+
- CGO_ENABLED=0
33+
goos:
1334
- windows
35+
goarch:
36+
- amd64
37+
- arm64
38+
ldflags:
39+
- -s -w
40+
- -X shield-cli/cmd.Version={{.Version}}
41+
- -X shield-cli/cmd.GitCommit={{.Commit}}
42+
- -X shield-cli/cmd.BuildTime={{.Date}}
43+
44+
# Linux: static build, no tray
45+
- id: linux
46+
main: .
47+
binary: shield
48+
env:
49+
- CGO_ENABLED=0
50+
goos:
51+
- linux
1452
goarch:
1553
- amd64
1654
- arm64
1755
- "386"
1856
goarm:
1957
- "7"
20-
ignore:
21-
- goos: darwin
22-
goarch: "386"
23-
- goos: windows
24-
goarch: arm
2558
ldflags:
2659
- -s -w
2760
- -X shield-cli/cmd.Version={{.Version}}

0 commit comments

Comments
 (0)