1
+ #! /bin/bash
2
+
3
+ # Script to export Apple Developer certificate for GitHub Actions
4
+ # Usage: ./scripts/export-certificate.sh
5
+
6
+ echo " Apple Developer Certificate Export Helper"
7
+ echo " ========================================"
8
+ echo " "
9
+ echo " This script will help you prepare your Developer ID Application certificate for GitHub Actions."
10
+ echo " "
11
+ echo " Prerequisites:"
12
+ echo " 1. Your 'Developer ID Application' certificate must be installed in Keychain Access"
13
+ echo " 2. You need to know the exact name of your certificate"
14
+ echo " "
15
+ echo " Steps this script will guide you through:"
16
+ echo " 1. List available Developer ID certificates"
17
+ echo " 2. Export the certificate as a .p12 file"
18
+ echo " 3. Convert it to base64 format"
19
+ echo " 4. Provide instructions for adding to GitHub Secrets"
20
+ echo " "
21
+
22
+ read -p " Press Enter to continue..."
23
+
24
+ echo " "
25
+ echo " Available Developer ID certificates in your keychain:"
26
+ echo " ----------------------------------------------------"
27
+ security find-identity -v -p codesigning | grep " Developer ID Application"
28
+
29
+ echo " "
30
+ echo " Copy the exact certificate name from above (everything after the quotes)."
31
+ read -p " Enter certificate name: " CERT_NAME
32
+
33
+ echo " "
34
+ read -p " Enter a password for the .p12 file (you'll need this for GitHub secrets): " -s P12_PASSWORD
35
+ echo " "
36
+
37
+ echo " "
38
+ echo " Exporting certificate..."
39
+ TEMP_P12=" /tmp/developer-cert.p12"
40
+
41
+ # Export the certificate
42
+ security export -k ~ /Library/Keychains/login.keychain-db -t identities -f pkcs12 -P " $P12_PASSWORD " -o " $TEMP_P12 " <<< " $CERT_NAME"
43
+
44
+ if [ $? -ne 0 ]; then
45
+ echo " Failed to export certificate. Please check the certificate name and try again."
46
+ exit 1
47
+ fi
48
+
49
+ echo " Certificate exported successfully!"
50
+ echo " "
51
+ echo " Converting to base64..."
52
+
53
+ # Convert to base64
54
+ CERT_BASE64=$( base64 < " $TEMP_P12 " )
55
+
56
+ # Clean up
57
+ rm " $TEMP_P12 "
58
+
59
+ echo " "
60
+ echo " Certificate prepared successfully!"
61
+ echo " "
62
+ echo " GitHub Secrets Setup Instructions:"
63
+ echo " =================================="
64
+ echo " "
65
+ echo " 1. Go to your GitHub repository: https://github.com/vijaythecoder/clueless"
66
+ echo " 2. Navigate to Settings > Secrets and variables > Actions"
67
+ echo " 3. Click 'New repository secret' and add the following secrets:"
68
+ echo " "
69
+ echo " NATIVEPHP_CERTIFICATE_BASE64"
70
+ echo " Value: (The base64 string has been copied to your clipboard)"
71
+ echo " "
72
+ echo " NATIVEPHP_CERTIFICATE_PASSWORD"
73
+ echo " Value: $P12_PASSWORD "
74
+ echo " "
75
+ echo " NATIVEPHP_APPLE_ID"
76
+
77
+ echo " "
78
+ echo " NATIVEPHP_APPLE_ID_PASS"
79
+ echo " Value: uyqq-dvig-nwxf-rdeu"
80
+ echo " "
81
+ echo " NATIVEPHP_APPLE_TEAM_ID"
82
+ echo " Value: 9D7F3MX3L3"
83
+ echo " "
84
+
85
+ # Copy to clipboard if possible
86
+ if command -v pbcopy & > /dev/null; then
87
+ echo " $CERT_BASE64 " | pbcopy
88
+ echo " ✅ The base64 certificate has been copied to your clipboard!"
89
+ else
90
+ echo " Base64 certificate (copy this for NATIVEPHP_CERTIFICATE_BASE64):"
91
+ echo " ================================================================"
92
+ echo " $CERT_BASE64 "
93
+ echo " ================================================================"
94
+ fi
95
+
96
+ echo " "
97
+ echo " After adding all secrets, the next build will be properly signed!"
0 commit comments