@@ -248,29 +248,39 @@ runs:
248248
249249 if [ -n "${{ inputs.certificate-file }}" ]; then
250250 # Use certificate file directly
251- cp "${{ inputs.certificate-file }}" $CERTIFICATE_PATH
251+ cp "${{ inputs.certificate-file }}" " $CERTIFICATE_PATH"
252252 else
253253 # Decode base64 certificate
254- echo -n "${{ inputs.certificate-base64 }}" | base64 --decode -o $CERTIFICATE_PATH
254+ echo -n "${{ inputs.certificate-base64 }}" | base64 --decode -o " $CERTIFICATE_PATH"
255255 fi
256+
257+ # Import the certificate silently (suppress sensitive output)
256258 if [ -n "${{ inputs.certificate-password }}" ]; then
257- security import $CERTIFICATE_PATH -P "${{ inputs.certificate-password }}" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
258- else
259- SECURITY_IMPORT_ERROR=$(security import $CERTIFICATE_PATH -A -t cert -f pkcs12 -k $KEYCHAIN_PATH 2>&1)
259+ SECURITY_IMPORT_ERROR=$(security import "$CERTIFICATE_PATH" -P "${{ inputs.certificate-password }}" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" 2>&1)
260260 if [ $? -ne 0 ]; then
261- echo "Certificate import failed. If this P12 file requires a password, please provide certificate-password input."
261+ echo "Certificate import failed with provided password."
262+ echo "Error output from 'security import':"
263+ echo "$SECURITY_IMPORT_ERROR"
264+ exit 1
265+ fi
266+ else
267+ SECURITY_IMPORT_ERROR=$(security import "$CERTIFICATE_PATH" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" 2>&1)
268+ SECURITY_IMPORT_EXIT_CODE=$?
269+ if [ $SECURITY_IMPORT_EXIT_CODE -ne 0 ]; then
270+ echo "Certificate import failed. If this P12 file requires a password, please provide 'certificate-password' input."
262271 echo "Error output from 'security import':"
263272 echo "$SECURITY_IMPORT_ERROR"
264273 exit 1
265274 fi
266275 fi
267- security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
268- security list-keychain -d user -s $KEYCHAIN_PATH
269276
270- # Infer certificate identity
271- IDENTITY=$(security find-identity -v -p codesigning $KEYCHAIN_PATH | grep -oE '([0-9A-F]{40})' | head -n 1)
272- echo "Certificate identity: $IDENTITY"
273- echo "IDENTITY=$IDENTITY" >> $GITHUB_ENV
277+ security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" >/dev/null
278+ security list-keychain -d user -s "$KEYCHAIN_PATH" >/dev/null
279+
280+ # Infer certificate identity (safe: SHA-1 fingerprint only)
281+ IDENTITY=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep -oE '([0-9A-F]{40})' | head -n 1)
282+ echo "Using signing identity (SHA-1): ${IDENTITY:0:8}…"
283+ echo "IDENTITY=$IDENTITY" >> "$GITHUB_ENV"
274284
275285 # Unpack provisioning profile (legacy single profile support)
276286 PROFILE_DIR="$HOME/Library/MobileDevice/Provisioning Profiles"
0 commit comments