Skip to content

Commit 7ad643a

Browse files
Create a single universal executable for macos
1 parent 6220828 commit 7ad643a

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

.github/workflows/release.yml

+29-10
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+
shell: zsh
135+
run: lipo -create -output ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}_amd64 ${{ env.PROJECT_NAME }}_arm64
117136
if: matrix.os == 'macos-12'
118137

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

124-
# for now we do not distribute m1 build, this is a workaround for now
143+
# 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: |
@@ -132,7 +151,7 @@ jobs:
132151
- name: Create autoupdate files for win32
133152
run: go-selfupdate -platform windows-${{ matrix.arch }} ${{ env.PROJECT_NAME }}${{ matrix.ext }} ${TAG_VERSION}
134153
if: matrix.arch == '386' && matrix.os == 'windows-2019' && steps.prerelease.outputs.IS_PRE != 'true'
135-
154+
136155
- name: configure aws credentials
137156
uses: aws-actions/configure-aws-credentials@v4
138157
with:
@@ -311,7 +330,7 @@ jobs:
311330
run: |
312331
wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
313332
unzip gon_macos.zip -d /usr/local/bin
314-
333+
315334
- name: Write gon config to file
316335
run: |
317336
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
@@ -323,7 +342,7 @@ jobs:
323342
}
324343
325344
EOF
326-
345+
327346
- name: Notarize app bundle
328347
run: |
329348
gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}"
@@ -449,17 +468,17 @@ jobs:
449468
# We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
450469
# Keep in mind that this path could change when upgrading to a new runner version
451470
SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
452-
471+
453472
strategy:
454473
matrix:
455474
arch: [amd64, 386]
456-
475+
457476
steps:
458477
- name: Download artifact
459478
uses: actions/download-artifact@v4
460479
with:
461480
name: ArduinoCreateAgent-windows-${{ matrix.arch }}
462-
481+
463482
- name: Save Win signing certificate to file
464483
run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_CER }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER}}
465484

@@ -468,7 +487,7 @@ jobs:
468487
CERT_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
469488
CONTAINER_NAME: ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
470489
# https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing-with-safenet-etoken
471-
run: |
490+
run: |
472491
"${{ env.SIGNTOOL_PATH }}" sign -d "Arduino Create Agent" -f ${{ env.INSTALLER_CERT_WINDOWS_CER}} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v "ArduinoCreateAgent-${GITHUB_REF##*/}-windows-${{ matrix.arch }}-installer.exe"
473492
474493
- name: Upload artifacts

0 commit comments

Comments
 (0)