fix(workflows): improve keychain handling and identity extraction in local signing workflow
Some checks failed
Test Local Signing / test-local-signing (push) Failing after 7s
Some checks failed
Test Local Signing / test-local-signing (push) Failing after 7s
This commit is contained in:
parent
52bb9a0f7b
commit
8dcb496b3c
@ -33,25 +33,33 @@ jobs:
|
|||||||
echo "🔍 Certificate info:"
|
echo "🔍 Certificate info:"
|
||||||
file certificate.p12
|
file certificate.p12
|
||||||
|
|
||||||
# Create keychain
|
# Create keychain with a fixed password
|
||||||
KEYCHAIN_PATH="$CERT_DIR/build.keychain"
|
KEYCHAIN_PATH="$CERT_DIR/build.keychain-db"
|
||||||
KEYCHAIN_PASSWORD="temporary$(date +%s)"
|
KEYCHAIN_PASSWORD="keychainpassword"
|
||||||
|
|
||||||
echo "🔐 Creating keychain: $KEYCHAIN_PATH"
|
echo "🔐 Creating keychain: $KEYCHAIN_PATH"
|
||||||
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||||
|
|
||||||
|
# Configure keychain settings
|
||||||
|
security set-keychain-settings -t 3600 -l "$KEYCHAIN_PATH"
|
||||||
|
|
||||||
|
# Add to keychain list and make it default
|
||||||
|
security list-keychains -d user -s "$KEYCHAIN_PATH" $(security list-keychains -d user | sed s/\"//g)
|
||||||
security default-keychain -s "$KEYCHAIN_PATH"
|
security default-keychain -s "$KEYCHAIN_PATH"
|
||||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||||
|
|
||||||
# Import certificate
|
# Import certificate with all access rights
|
||||||
echo "📥 Importing certificate..."
|
echo "📥 Importing certificate..."
|
||||||
security import certificate.p12 \
|
security import certificate.p12 \
|
||||||
-k "$KEYCHAIN_PATH" \
|
-k "$KEYCHAIN_PATH" \
|
||||||
-P "$CERTIFICATE_PASSWORD" \
|
-P "$CERTIFICATE_PASSWORD" \
|
||||||
-T /usr/bin/codesign
|
-T "/usr/bin/codesign" \
|
||||||
|
-T "/usr/bin/security" \
|
||||||
|
-T "/usr/bin/xcrun"
|
||||||
|
|
||||||
# Configure keychain settings
|
# Update keychain partition list
|
||||||
security set-key-partition-list \
|
security set-key-partition-list \
|
||||||
-S apple-tool:,apple: \
|
-S apple-tool:,apple:,codesign: \
|
||||||
-s \
|
-s \
|
||||||
-k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
-k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||||
|
|
||||||
@ -61,14 +69,26 @@ jobs:
|
|||||||
echo "APPLE_TEAM_ID=$APPLE_TEAM_ID" >> "$GITHUB_ENV"
|
echo "APPLE_TEAM_ID=$APPLE_TEAM_ID" >> "$GITHUB_ENV"
|
||||||
echo "WORKSPACE_DIR=$(pwd)" >> "$GITHUB_ENV"
|
echo "WORKSPACE_DIR=$(pwd)" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
# Check certificate status
|
# Check certificate status and get identity
|
||||||
echo "✅ Checking codesigning identities..."
|
echo "✅ Checking codesigning identities..."
|
||||||
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
|
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
|
||||||
|
|
||||||
|
# Extract the identity hash for signing
|
||||||
|
IDENTITY_HASH=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep "Developer ID Application" | head -1 | awk '{print $2}')
|
||||||
|
if [ -n "$IDENTITY_HASH" ]; then
|
||||||
|
echo "Found identity hash: $IDENTITY_HASH"
|
||||||
|
echo "IDENTITY_HASH=$IDENTITY_HASH" >> "$GITHUB_ENV"
|
||||||
|
else
|
||||||
|
echo "No valid identity hash found"
|
||||||
|
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Verify Certificate
|
- name: Verify Certificate
|
||||||
run: |
|
run: |
|
||||||
echo "🔍 Verifying certificate in keychain..."
|
echo "🔍 Verifying certificate in keychain..."
|
||||||
|
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||||
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
|
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
|
||||||
|
|
||||||
echo "📋 Certificate details:"
|
echo "📋 Certificate details:"
|
||||||
@ -151,13 +171,11 @@ jobs:
|
|||||||
# Prepare keychain
|
# Prepare keychain
|
||||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||||
|
|
||||||
# Find signing identity
|
# Use identity hash directly for signing
|
||||||
SIGNING_IDENTITY="Developer ID Application: $APPLE_TEAM_ID"
|
echo "📝 Signing app bundle with identity hash: $IDENTITY_HASH"
|
||||||
echo "Using signing identity: $SIGNING_IDENTITY"
|
|
||||||
|
|
||||||
echo "📝 Signing app bundle..."
|
|
||||||
/usr/bin/codesign --force --deep --verbose \
|
/usr/bin/codesign --force --deep --verbose \
|
||||||
--sign "$SIGNING_IDENTITY" \
|
--keychain "$KEYCHAIN_PATH" \
|
||||||
|
--sign "$IDENTITY_HASH" \
|
||||||
--entitlements "LuckyWorld.entitlements" \
|
--entitlements "LuckyWorld.entitlements" \
|
||||||
"$APP_PATH"
|
"$APP_PATH"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user