Skip to content

Commit 043f392

Browse files
Create a single universal executable for macos
1 parent 04414e2 commit 043f392

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/release.yml

+22-3
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,40 @@ jobs:
107107
run: task go:build-win # GOARCH=amd64 by default on the runners
108108
if: matrix.os == 'windows-2019' && matrix.arch == 'amd64'
109109

110-
- name: Build the Agent for macos
110+
- name: Build the Agent for macos amd64
111111
env:
112112
CGO_ENABLED: 1
113113
MACOSX_DEPLOYMENT_TARGET: 10.15 # minimum supported version for mac
114114
CGO_CFLAGS: -mmacosx-version-min=10.15
115115
CGO_LDFLAGS: -mmacosx-version-min=10.15
116-
run: task go:build
116+
run: |
117+
task go:build
118+
mv ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}_amd64
119+
if: matrix.os == 'macos-12'
120+
121+
- name: Build the Agent for macos arm64
122+
env:
123+
CGO_ENABLED: 1
124+
MACOSX_DEPLOYMENT_TARGET: 10.15 # minimum supported version for mac
125+
CGO_CFLAGS: -mmacosx-version-min=10.15
126+
CGO_LDFLAGS: -mmacosx-version-min=10.15
127+
GOARCH: arm64
128+
run: |
129+
task go:build
130+
mv ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}_arm64
131+
if: matrix.os == 'macos-12'
132+
133+
- name: Create universal macos executable
134+
run: |
135+
lipo -create -output ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}_amd64 ${{ env.PROJECT_NAME }}_arm64
136+
rm ${{ env.PROJECT_NAME }}_amd64 ${{ env.PROJECT_NAME }}_arm64
117137
if: matrix.os == 'macos-12'
118138

119139
# this will create `public/` dir with compressed full bin (<version>/<os>-<arch>.gz) and a json file
120140
- name: Create autoupdate files
121141
run: go-selfupdate ${{ env.PROJECT_NAME }}${{ matrix.ext }} ${TAG_VERSION}
122142
if: matrix.arch != '386' && steps.prerelease.outputs.IS_PRE != 'true'
123143

124-
# for now we do not distribute m1 build, this is a workaround for now
125144
- name: Copy autoupdate file for darwin-arm64 (m1 arch)
126145
working-directory: public/
127146
run: |

0 commit comments

Comments
 (0)