Skip to content

Commit 320940f

Browse files
committed
release: use osxcross for better cross compiling support
Updates the release process to perform better cross compiling support and ultimately, set `CGO_ENABLED=1` in the releases. This does drop Windows and FreeBSD support however, I don't have a great testing story for them at the moment so we can revisit when/if the request arises.
1 parent 46191e7 commit 320940f

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
uses: actions/setup-go@v3
2121
with:
2222
go-version: "1.20"
23+
- name: OSXCross for CGO Support
24+
run: |
25+
mkdir ../../osxcross
26+
git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target
2327
- name: Run GoReleaser
2428
uses: goreleaser/goreleaser-action@v4
2529
with:

.goreleaser.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
builds:
2-
- env:
3-
- CGO_ENABLED=0
4-
mod_timestamp: '{{ .CommitTimestamp }}'
2+
- id: linux-build
53
flags:
64
- -trimpath
75
asmflags:
@@ -10,16 +8,39 @@ builds:
108
- all=-trimpath=$GOPATH
119
ldflags:
1210
- -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }}
11+
env:
12+
- CGO_ENABLED=1
1313
goos:
14-
- darwin
15-
- freebsd
1614
- linux
17-
- windows
15+
ignore:
16+
- goos: linux
17+
goarch: "386"
18+
- id: darwin-build
19+
flags:
20+
- -trimpath
21+
asmflags:
22+
- all=-trimpath=$GOPATH
23+
gcflags:
24+
- all=-trimpath=$GOPATH
25+
ldflags:
26+
- -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }}
27+
env:
28+
- CGO_ENABLED=1
29+
- CC=/home/runner/work/osxcross/target/bin/o64-clang
30+
- CXX=/home/runner/work/osxcross/target/bin/o64-clang++
31+
goos:
32+
- darwin
33+
ignore:
34+
- goos: darwin
35+
goarch: "386"
36+
1837
archives:
1938
- format: zip
2039
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
40+
2141
checksum:
2242
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
2343
algorithm: sha256
44+
2445
changelog:
2546
skip: true

0 commit comments

Comments
 (0)