timeout doesn't exist

This commit is contained in:
Connor Yoh 2025-07-11 14:03:39 +01:00
parent a34b7ed291
commit 526b61237e

View File

@ -242,33 +242,39 @@ jobs:
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security set-keychain-settings -t 3600 -u build.keychain security set-keychain-settings -t 3600 -u build.keychain
# Add timeout and proper error handling # Try jarsigner with proper error handling
timeout 300 jarsigner -verbose \ echo "Attempting jarsigner with KeychainStore..."
if jarsigner -verbose \
-keystore "$KEYCHAIN_PATH" \ -keystore "$KEYCHAIN_PATH" \
-storetype KeychainStore \ -storetype KeychainStore \
-storepass "$KEYCHAIN_PASSWORD" \ -storepass "$KEYCHAIN_PASSWORD" \
-signedjar "${MAIN_JAR}.signed" \ -signedjar "${MAIN_JAR}.signed" \
"$MAIN_JAR" \ "$MAIN_JAR" \
"$CERT_ID" || { "$CERT_ID"; then
echo "❌ jarsigner failed or timed out" echo "✅ KeychainStore signing successful"
else
echo "❌ KeychainStore signing failed"
echo "Trying alternative approach with PKCS12 keystore..." echo "Trying alternative approach with PKCS12 keystore..."
# Convert to PKCS12 and try again # Convert to PKCS12 and try again
security export -k build.keychain -t identities -f pkcs12 -o temp_cert.p12 -P "$APPLE_CERTIFICATE_PASSWORD" security export -k build.keychain -t identities -f pkcs12 -o temp_cert.p12 -P "$APPLE_CERTIFICATE_PASSWORD"
timeout 300 jarsigner -verbose \ if jarsigner -verbose \
-keystore temp_cert.p12 \ -keystore temp_cert.p12 \
-storetype PKCS12 \ -storetype PKCS12 \
-storepass "$APPLE_CERTIFICATE_PASSWORD" \ -storepass "$APPLE_CERTIFICATE_PASSWORD" \
-signedjar "${MAIN_JAR}.signed" \ -signedjar "${MAIN_JAR}.signed" \
"$MAIN_JAR" \ "$MAIN_JAR" \
1 || { 1; then
echo "✅ PKCS12 signing successful"
else
echo "❌ Both signing methods failed" echo "❌ Both signing methods failed"
rm -f temp_cert.p12
exit 1 exit 1
} fi
rm -f temp_cert.p12 rm -f temp_cert.p12
} fi
# Replace original with signed JAR # Replace original with signed JAR
mv "${MAIN_JAR}.signed" "$MAIN_JAR" mv "${MAIN_JAR}.signed" "$MAIN_JAR"