Skip to content

Commit 35a05dc

Browse files
authored
Replace mitchellh/go used for macOS notarization (#851)
* switch to gon fork, apple is deprecating altool to notarize. I split the singing/notarization because Bearer fork does not implement `--deep` for signing * use `ditto` to create archive: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow * remove stapling, we cannot staple a zip apparently * remove top level dir it's already there thanks to `ditto --keepParent
1 parent 9358518 commit 35a05dc

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

.github/workflows/release.yml

+34-16
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12"
2121
AC_USERNAME: ${{ secrets.AC_USERNAME }} # used by gon
2222
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} # used by gon
23+
AC_PROVIDER: ${{ secrets.AC_PROVIDER }} # used by gon
2324
# See: https://github.com/actions/setup-go/tree/v3#readme
2425
GO_VERSION: "1.20"
2526

@@ -261,7 +262,7 @@ jobs:
261262
-k "${{ env.KEYCHAIN_PASSWORD }}" \
262263
"${{ env.KEYCHAIN }}"
263264
264-
- name: Install gon for code signing and app notarization
265+
- name: Install gon for code signing
265266
uses: actions/checkout@v4
266267
with:
267268
repository: darkvertex/gon #this fork has support for --deep notarization
@@ -288,16 +289,40 @@ jobs:
288289
deep = true
289290
}
290291
291-
# Ask Gon for zip output to force notarization process to take place.
292-
# The CI will upload the zip output
293-
zip {
294-
output_path = "ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip"
295-
}
296292
EOF
297293
298-
- name: Sign and notarize binary
294+
- name: Sign app bundle
299295
run: gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}"
300296

297+
- name: Zip output app bundle
298+
run: ditto -c -k --keepParent ArduinoCreateAgent.app/ ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip
299+
300+
- name: Remove gon used for code signing
301+
run: |
302+
rm /usr/local/bin/gon
303+
rm ${{ env.GON_CONFIG_PATH }}
304+
305+
- name: Install gon for app notarization
306+
run: |
307+
wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
308+
unzip gon_macos.zip -d /usr/local/bin
309+
310+
- name: Write gon config to file
311+
run: |
312+
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
313+
# See: https://github.com/Bearer/gon#configuration-file
314+
315+
notarize {
316+
path = "ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip"
317+
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
318+
}
319+
320+
EOF
321+
322+
- name: Notarize app bundle
323+
run: |
324+
gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}"
325+
301326
- name: Upload autoupdate bundle to Arduino downloads servers
302327
run: aws s3 cp ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}${GITHUB_REF/refs\/tags\//}/ # the version should be created in th the build job
303328
if: ${{ needs.build.outputs.prerelease != 'true' }}
@@ -430,13 +455,10 @@ jobs:
430455
uses: actions/download-artifact@v3
431456
with:
432457
name: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized
433-
path: ArduinoCreateAgent.app
434458

435459
- name: unzip artifact
436-
working-directory: ArduinoCreateAgent.app
437460
run: |
438461
unzip ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip
439-
rm ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip
440462
441463
- name: Install create-dmg
442464
run: brew install create-dmg
@@ -475,7 +497,7 @@ jobs:
475497
476498
- name: Install gon for code signing and app notarization
477499
run: |
478-
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.5/gon_macos.zip
500+
wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
479501
unzip gon_macos.zip -d /usr/local/bin
480502
481503
- name: Write gon config to file
@@ -490,17 +512,13 @@ jobs:
490512
}
491513
492514
# Ask Gon for zip output to force notarization process to take place.
493-
# The CI will not upload the zip output
494515
zip {
495516
output_path = "ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip"
496517
}
497518
EOF
498519
499520
- name: Code sign and notarize app
500-
run: |
501-
echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg"
502-
gon -log-level=debug -log-json gon.config_installer.hcl
503-
timeout-minutes: 30
521+
run: gon -log-level=debug -log-json gon.config_installer.hcl
504522

505523
# tar dmg file to keep executable permission
506524
- name: Tar files to keep permissions

0 commit comments

Comments
 (0)