@@ -380,14 +380,23 @@ jobs:
380380 uses : ./.github/release/download
381381 with :
382382 pattern : " {build-npm,build-desktop-darwin-*}"
383+ # The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up
384+ # the identity in build.keychain, and codesign finds the key through the user search list.
383385 - name : Import certificate
384386 if : needs.plan.outputs.dry_run != 'true'
385- uses : apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2.0.0
386- with :
387- keychain : build
388- p12-file-base64 : ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
389- # The certificate has no password; the action passes this to `security import -P`.
390- p12-password : " "
387+ run : |
388+ cert="$RUNNER_TEMP/cert.p12"
389+ keychain_password=$(openssl rand -base64 32)
390+ printf '%s' "$APPLE_SIGNING_CERTIFICATE" | base64 --decode > "$cert"
391+ security create-keychain -p "$keychain_password" build.keychain
392+ security set-keychain-settings -lut 21600 build.keychain
393+ security unlock-keychain -p "$keychain_password" build.keychain
394+ security import "$cert" -k build.keychain -P "" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productsign
395+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null
396+ security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')
397+ rm -f "$cert"
398+ env :
399+ APPLE_SIGNING_CERTIFICATE : ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
391400 - name : Sign CLI
392401 if : needs.plan.outputs.cli == 'true'
393402 run : bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out"
@@ -406,6 +415,11 @@ jobs:
406415 with :
407416 name : sign-macos
408417 path : ${{ runner.temp }}/out
418+ - name : Delete keychain
419+ if : always() && needs.plan.outputs.dry_run != 'true'
420+ run : |
421+ rm -f "$RUNNER_TEMP/cert.p12"
422+ security delete-keychain build.keychain || true
409423
410424 # Signs the Windows CLI and every executable and native module of the unpacked desktop apps.
411425 sign-windows :
0 commit comments