|
| 1 | +# 📱 Google Play Service Account JSON - دليل الحصول |
| 2 | + |
| 3 | +## 🔗 **الروابط المهمة:** |
| 4 | + |
| 5 | +### **1. Google Play Console:** |
| 6 | +``` |
| 7 | +https://play.google.com/console |
| 8 | +``` |
| 9 | + |
| 10 | +### **2. Google Cloud Console (لإنشاء Service Account):** |
| 11 | +``` |
| 12 | +https://console.cloud.google.com/ |
| 13 | +``` |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## 📋 **خطوات الحصول على Service Account JSON:** |
| 18 | + |
| 19 | +### **الخطوة 1: إنشاء Service Account في Google Cloud Console** |
| 20 | + |
| 21 | +1. **اذهب إلى Google Cloud Console:** |
| 22 | + ``` |
| 23 | + https://console.cloud.google.com/ |
| 24 | + ``` |
| 25 | + |
| 26 | +2. **اختر أو أنشئ Project:** |
| 27 | + - إذا لم يكن لديك Project، أنشئ واحد جديد |
| 28 | + - أو اختر Project موجود |
| 29 | + |
| 30 | +3. **افتح Service Accounts:** |
| 31 | + - من القائمة الجانبية: **IAM & Admin** → **Service Accounts** |
| 32 | + - أو اذهب مباشرة: |
| 33 | + ``` |
| 34 | + https://console.cloud.google.com/iam-admin/serviceaccounts |
| 35 | + ``` |
| 36 | + |
| 37 | +4. **أنشئ Service Account جديد:** |
| 38 | + - اضغط **Create Service Account** |
| 39 | + - **Service account name:** `rare4n-play-store` |
| 40 | + - **Service account ID:** `rare4n-play-store` (يتم إنشاؤه تلقائياً) |
| 41 | + - **Description:** `Service account for RARE 4N Play Store uploads` |
| 42 | + - اضغط **Create and Continue** |
| 43 | + |
| 44 | +5. **إضافة Roles (اختياري):** |
| 45 | + - يمكنك تخطي هذه الخطوة الآن |
| 46 | + - اضغط **Continue** |
| 47 | + |
| 48 | +6. **Grant access (اختياري):** |
| 49 | + - يمكنك تخطي هذه الخطوة |
| 50 | + - اضغط **Done** |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +### **الخطوة 2: إنشاء JSON Key** |
| 55 | + |
| 56 | +1. **في صفحة Service Accounts:** |
| 57 | + - ابحث عن Service Account الذي أنشأته |
| 58 | + - اضغط على **Email** الخاص به |
| 59 | + |
| 60 | +2. **افتح Keys tab:** |
| 61 | + - اضغط على **Keys** من القائمة العلوية |
| 62 | + - أو اذهب مباشرة: |
| 63 | + ``` |
| 64 | + https://console.cloud.google.com/iam-admin/serviceaccounts?project=YOUR_PROJECT_ID |
| 65 | + ``` |
| 66 | + - ثم اضغط على Service Account → **Keys** tab |
| 67 | + |
| 68 | +3. **أنشئ Key جديد:** |
| 69 | + - اضغط **Add Key** → **Create new key** |
| 70 | + - اختر **JSON** |
| 71 | + - اضغط **Create** |
| 72 | + |
| 73 | +4. **تحميل JSON:** |
| 74 | + - سيتم تحميل ملف JSON تلقائياً |
| 75 | + - احفظه في مكان آمن |
| 76 | + - **⚠️ مهم:** هذا الملف حساس جداً، لا ترفعه على GitHub! |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +### **الخطوة 3: ربط Service Account مع Google Play Console** |
| 81 | + |
| 82 | +1. **اذهب إلى Google Play Console:** |
| 83 | + ``` |
| 84 | + https://play.google.com/console |
| 85 | + ``` |
| 86 | + |
| 87 | +2. **افتح Settings:** |
| 88 | + - من القائمة الجانبية: **Settings** → **API access** |
| 89 | + - أو اذهب مباشرة: |
| 90 | + ``` |
| 91 | + https://play.google.com/console/developers/api-access |
| 92 | + ``` |
| 93 | + |
| 94 | +3. **Link Service Account:** |
| 95 | + - في قسم **Service accounts** |
| 96 | + - اضغط **Link service account** |
| 97 | + - اختر Service Account الذي أنشأته |
| 98 | + - اضغط **Grant access** |
| 99 | + |
| 100 | +4. **إضافة Permissions:** |
| 101 | + - **App information and pricing:** ✅ |
| 102 | + - **Manage production releases:** ✅ |
| 103 | + - **Manage testing track releases:** ✅ |
| 104 | + - **View app information and download bulk reports:** ✅ |
| 105 | + - اضغط **Invite user** |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## 📄 **مثال على JSON File:** |
| 110 | + |
| 111 | +```json |
| 112 | +{ |
| 113 | + "type": "service_account", |
| 114 | + "project_id": "your-project-id", |
| 115 | + "private_key_id": "key-id", |
| 116 | + "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n", |
| 117 | + "client_email": "rare4n-play-store@your-project-id.iam.gserviceaccount.com", |
| 118 | + "client_id": "123456789", |
| 119 | + "auth_uri": "https://accounts.google.com/o/oauth2/auth", |
| 120 | + "token_uri": "https://oauth2.googleapis.com/token", |
| 121 | + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", |
| 122 | + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/rare4n-play-store%40your-project-id.iam.gserviceaccount.com" |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## 🔐 **أين تضع هذا الملف:** |
| 129 | + |
| 130 | +### **❌ لا ترفعه على GitHub:** |
| 131 | +- لا ترفع ملف JSON على GitHub |
| 132 | +- أضفه في `.gitignore` |
| 133 | + |
| 134 | +### **✅ ضعه في:** |
| 135 | + |
| 136 | +1. **GitHub Secrets:** |
| 137 | + - اذهب إلى: `Settings` → `Secrets and variables` → `Actions` |
| 138 | + - أنشئ Secret جديد: `GOOGLE_PLAY_SERVICE_ACCOUNT_JSON` |
| 139 | + - **انسخ محتوى JSON كاملاً** (كـ string واحد) |
| 140 | + - أو استخدم Base64 encoding (اختياري) |
| 141 | + |
| 142 | +2. **Backend .env (على السيرفر فقط):** |
| 143 | + ```bash |
| 144 | + GOOGLE_PLAY_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}' |
| 145 | + ``` |
| 146 | + - أو احفظه كملف على السيرفر: |
| 147 | + ```bash |
| 148 | + GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_PATH=/path/to/service-account.json |
| 149 | + ``` |
| 150 | + |
| 151 | +3. **EAS Credentials (Expo):** |
| 152 | + ```bash |
| 153 | + eas credentials |
| 154 | + # اختر Android |
| 155 | + # اختر Google Play Service Account |
| 156 | + # الصق محتوى JSON |
| 157 | + ``` |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## 🔗 **الروابط السريعة:** |
| 162 | + |
| 163 | +### **Google Cloud Console:** |
| 164 | +- **Service Accounts:** https://console.cloud.google.com/iam-admin/serviceaccounts |
| 165 | +- **Create Service Account:** https://console.cloud.google.com/iam-admin/serviceaccounts/create |
| 166 | + |
| 167 | +### **Google Play Console:** |
| 168 | +- **API Access:** https://play.google.com/console/developers/api-access |
| 169 | +- **Main Console:** https://play.google.com/console |
| 170 | + |
| 171 | +### **Documentation:** |
| 172 | +- **Official Guide:** https://developers.google.com/android-publisher/getting_started |
| 173 | +- **Service Accounts:** https://cloud.google.com/iam/docs/service-accounts |
| 174 | + |
| 175 | +--- |
| 176 | + |
| 177 | +## ⚠️ **ملاحظات مهمة:** |
| 178 | + |
| 179 | +1. **الأمان:** |
| 180 | + - ⚠️ ملف JSON حساس جداً |
| 181 | + - ⚠️ لا ترفعه على GitHub |
| 182 | + - ⚠️ لا تشاركه مع أحد |
| 183 | + - ✅ ضعه في GitHub Secrets فقط |
| 184 | + |
| 185 | +2. **Permissions:** |
| 186 | + - تأكد من إعطاء الصلاحيات الصحيحة في Play Console |
| 187 | + - قد تحتاج إلى **Owner** أو **Admin** في Google Play Console |
| 188 | + |
| 189 | +3. **Project ID:** |
| 190 | + - تأكد من أن Project ID في JSON صحيح |
| 191 | + - تأكد من ربط Service Account مع Play Console |
| 192 | + |
| 193 | +4. **Testing:** |
| 194 | + - اختبر الـ upload أولاً على **Internal Testing** |
| 195 | + - ثم **Closed Testing** |
| 196 | + - ثم **Production** |
| 197 | + |
| 198 | +--- |
| 199 | + |
| 200 | +## 📝 **خطوات سريعة (Quick Steps):** |
| 201 | + |
| 202 | +1. ✅ اذهب إلى: https://console.cloud.google.com/iam-admin/serviceaccounts |
| 203 | +2. ✅ أنشئ Service Account جديد |
| 204 | +3. ✅ أنشئ JSON Key |
| 205 | +4. ✅ حمّل JSON file |
| 206 | +5. ✅ اذهب إلى: https://play.google.com/console/developers/api-access |
| 207 | +6. ✅ Link Service Account |
| 208 | +7. ✅ أضف Permissions |
| 209 | +8. ✅ ضع JSON في GitHub Secrets |
| 210 | + |
| 211 | +--- |
| 212 | + |
| 213 | +## 🚀 **بعد الحصول على JSON:** |
| 214 | + |
| 215 | +### **في GitHub Secrets:** |
| 216 | +``` |
| 217 | +Name: GOOGLE_PLAY_SERVICE_ACCOUNT_JSON |
| 218 | +Value: (انسخ محتوى JSON كاملاً) |
| 219 | +``` |
| 220 | + |
| 221 | +### **في EAS (Expo):** |
| 222 | +```bash |
| 223 | +eas credentials |
| 224 | +# Android → Google Play → Service Account |
| 225 | +# الصق JSON |
| 226 | +``` |
| 227 | + |
| 228 | +--- |
| 229 | + |
| 230 | +**تم الإنشاء:** 2025-01-XX |
| 231 | +**الحالة:** ✅ جاهز للاستخدام |
| 232 | + |
0 commit comments