mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-24 19:31:51 +01:00
fix(packaging): keep the macOS signing keychain after a successful import
import-cert.sh deleted the temporary keychain on every exit, including success, so it was gone before package.sh signed with it in the next step. The v0.22.0 macOS release failed at the first codesign call with "The specified item could not be found in the keychain." The decoded certificate is still removed on every exit. The keychain and its folder are now removed only when the import fails; on success the release workflow's clean-up step deletes the keychain, as before #5923. This matches the shared import-macos-certificate action.
This commit is contained in:
1 parent
a18498e835
commit
65aac4ae89
1 file changed
+13
-3
@@ -24,9 +24,19 @@ KEYCHAIN="$TMP/pdfcraft-signing.keychain-db"
|
||||
CERT="$TMP/pdfcraft-signing.p12"
|
||||
KC_PASS="${KEYCHAIN_PASSWORD:-$(openssl rand -hex 24)}"
|
||||
|
||||
# Every exit path removes the keychain and the folder holding it: the keychain keeps the signing
|
||||
# identity, and each run makes a new folder under a temporary parent that can outlive the job.
|
||||
trap 'rm -f "$CERT"; security delete-keychain "$KEYCHAIN" 2>/dev/null || true; rm -rf "$TMP"' EXIT
|
||||
# The decoded bundle is removed on every exit. The keychain and its folder are kept on success,
|
||||
# because package.sh signs with them in a later step (the release workflow's clean-up step deletes
|
||||
# the keychain), and removed only when this script fails.
|
||||
cleanup() {
|
||||
local status=$?
|
||||
rm -f "$CERT"
|
||||
if [[ "$status" -ne 0 ]]; then
|
||||
security delete-keychain "$KEYCHAIN" 2>/dev/null || true
|
||||
rm -rf "$TMP"
|
||||
fi
|
||||
exit "$status"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
printf '%s' "$APPLE_CERTIFICATE" | base64 --decode >"$CERT"
|
||||
security create-keychain -p "$KC_PASS" "$KEYCHAIN"
|
||||
security set-keychain-settings -lut 21600 "$KEYCHAIN"
|
||||
|
||||
Reference in new issue
Block a user