Skip to content

Commit 009b6a8

Browse files
committed
Embed Info.plist into the binary on macOS
1 parent 1acc73e commit 009b6a8

3 files changed

Lines changed: 29 additions & 12 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ dist/
88
.run
99

1010
# binary files like goreleaser binary
11-
bin
11+
bin
12+
13+
# GoReleaser's Info.plist embedding
14+
Info.generated.plist

.goreleaser.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,20 @@ project_name: cirrus
55
before:
66
hooks:
77
- go mod download
8+
- sh -c "sed 's/__VERSION__/{{ .Version }}/g' Info.plist > Info.generated.plist"
89

910
builds:
1011
- main: cmd/cirrus/main.go
11-
ldflags: >
12-
-X github.com/cirruslabs/cirrus-cli/internal/version.Version={{.Version}}
13-
-X github.com/cirruslabs/cirrus-cli/internal/version.Commit={{.ShortCommit}}
12+
ldflags:
13+
- -X github.com/cirruslabs/cirrus-cli/internal/version.Version={{.Version}}
14+
- -X github.com/cirruslabs/cirrus-cli/internal/version.Commit={{.ShortCommit}}
15+
- '{{- if eq .Os "darwin" }}-extldflags "-sectcreate __TEXT __info_plist Info.generated.plist"{{ end }}'
1416
env:
1517
- CGO_ENABLED={{if eq .Os "darwin"}}1{{else}}0{{end}}
1618
goos:
17-
- linux
18-
- windows
1919
- darwin
20-
- freebsd
21-
- openbsd
22-
- netbsd
2320
goarch:
24-
- amd64
25-
- arm
2621
- arm64
27-
- s390x
2822
ignore:
2923
- goos: windows
3024
goarch: arm

Info.plist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleName</key>
6+
<string>cirrus</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>cirrus</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>com.github.cirruslabs.cirrus-cli</string>
11+
<key>CFBundleExecutable</key>
12+
<string>tart</string>
13+
<key>CFBundlePackageType</key>
14+
<string>APPL</string>
15+
<key>CFBundleInfoDictionaryVersion</key>
16+
<string>6.0</string>
17+
<key>CFBundleVersion</key>
18+
<string>__VERSION__</string>
19+
</dict>
20+
</plist>

0 commit comments

Comments
 (0)