If you are building server-rendered Angular or Next.js apps, check out next-generation Firebase App Hosting, a full-stack solution for modern web frameworks.
النشر في البث المباشر معاينة القنوات عبر طلبات السحب في GitHub
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يمكنك دمج عمليات النشر في Firebase Hosting من خلال GitHub Action. إليك ما يمكن أن يقدّمه لك هذا الإجراء في GitHub:
ينشئ قناة معاينة جديدة (وعنوان URL المرتبط بها) لكل طلب سحب في مستودع GitHub.
يضيف تعليقًا إلى طلب السحب يتضمّن عنوان URL للمعاينة
ليتمكّن كل من المراجعين من عرض التغييرات في طلب السحب واختبارها
في إصدار "معاينة" من تطبيقك.
تعدّل عنوان URL الخاص بالمعاينة وفقًا للتغييرات الواردة في كل عملية إيداع من خلال النشر تلقائيًا في قناة المعاينة المرتبطة. لا يتغيّر عنوان URL مع كل عملية إيداع جديدة.
(اختياري) ينشر هذا الخيار الحالة الحالية لمستودع GitHub على قناتك المباشرة عند دمج طلب السحب.
تذكير: عند استخدام عناوين URL للمعاينة، يتفاعل تطبيقك مع موارد الخلفية الحقيقية لمشروعك على Firebase.
إعداد GitHub Action للنشر على Firebase Hosting
أنشئ مستودع GitHub (عامًا أو خاصًا) أو استخدِم مستودعًا حاليًا. يجب أن يكون لديك أذونات المشرف للمستودع.
في نسخة محلية من مستودعك، يمكنك إعداد Firebase Hosting باستخدام
الأمر firebase init.
إذا لم تكن قد أعددت Hosting، شغِّل هذا الإصدار من الأمر
من جذر الدليل المحلي:
firebase init hosting
إذا سبق لك إعداد Hosting، ما عليك سوى إعداد جزء GitHub Action من Hosting. نفِّذ هذه النسخة من الأمر من جذر الدليل المحلي:
firebase init hosting:github
اتّبِع طلبات واجهة سطر الأوامر، وسيتولّى الأمر تلقائيًا مهمة إعداد GitHub Action:
ينشئ هذا الأمر حساب خدمة في مشروعك على Firebase مع إذن بالتوزيع على Firebase Hosting.
يشفّر مفتاح JSON لحساب الخدمة هذا ويحمّله إلى مستودع GitHub المحدّد كـ سر GitHub.
يكتب ملفات إعداد yaml لسير عمل GitHub تشير إلى السر الذي تم إنشاؤه حديثًا. تضبط هذه الملفات GitHub Action على النشر إلى
Firebase Hosting.
في GitHub، أنشئ فرعًا جديدًا وأرسِل ملفات سير العمل yaml التي أنشأتها واجهة سطر الأوامر.
انشر الفرع في مستودع GitHub.
دمج الفرع
وهذا كل ما في الأمر! سيحصل أي طلب سحب لاحق في مستودع GitHub هذا تلقائيًا على "عنوان URL للمعاينة" خاص به.
مزيد من المعلومات حول GitHub Action
يحتفظ Firebase بإجراء GitHub "النشر إلى Firebase Hosting" كمشروع مفتوح المصدر.
عرض رمز المصدر
يتيح إجراء GitHub "النشر إلى Firebase Hosting" المزيد من خيارات الإعداد، مثل تخصيص تاريخ انتهاء صلاحية قناة المعاينة أو ضبط قناة غير مباشرة ليتم النشر إليها عند دمج طلب سحب.
مزيد من المعلومات عن خيارات الإعداد المتاحة
يمكنك الاطّلاع على مزيد من المعلومات عن
GitHub Actions بشكل عام.
تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nYou can integrate deploys to Firebase Hosting via a GitHub Action. Here's\nwhat this GitHub Action can do for you:\n\n- Creates a new preview channel (and its associated preview URL) for every PR on\n your GitHub repository.\n\n- Adds a comment to the PR with the preview URL\n so that you and each reviewer can view and test the PR's changes in a\n \"preview\" version of your app.\n\n- Updates the preview URL with changes from each commit by automatically\n deploying to the associated preview channel. The URL doesn't change with each\n new commit.\n\n- *(Optional)* Deploys the current state of your GitHub repo to your live\n channel when the PR is merged.\n\nReminder: When using preview URLs, your app interacts with the *real* backend\nresources of your Firebase project.\n\nSet up the GitHub Action to deploy to Firebase Hosting\n\n1. Create a GitHub repository (public or private) or use an existing one. You\n must have admin permissions for the repository.\n\n2. In a local version of your repo, set up Firebase Hosting using the\n [`firebase init` command](/docs/hosting/quickstart#initialize).\n\n - If you've NOT set up Hosting, run this version of the command\n from the root of your local directory:\n\n ```\n firebase init hosting\n ```\n - If you've ALREADY set up Hosting, then you just need to set up the\n GitHub Action part of Hosting. Run this version of the command from\n the root of your local directory:\n\n ```\n firebase init hosting:github\n ```\n3. Follow the CLI prompts, and the command will automatically take care of\n setting up the GitHub Action:\n\n - Creates a service account in your Firebase project with permission to\n deploy to Firebase Hosting.\n\n - Encrypts that service account's JSON key and uploads it to the specified\n GitHub repository as a\n [GitHub secret](//docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets).\n\n - Writes GitHub workflow `yaml` configuration files that reference the\n newly created secret. These files configure the GitHub Action to deploy to\n Firebase Hosting.\n\n4. In GitHub, create a new branch and commit the workflow `yaml` files created\n by the CLI.\n\n5. Publish the branch to your GitHub repository.\n\n6. Merge the branch.\n\nThat's it! Any subsequent PR in this GitHub repo will automatically get its own\n\"preview URL\"!\n\nLearn more about the GitHub Action\n\n- Firebase maintains the \"Deploy to Firebase Hosting\" GitHub Action as an\n open-source project.\n [View the source code.](//github.com/marketplace/actions/deploy-to-firebase-hosting)\n\n- The \"Deploy to Firebase Hosting\" GitHub Action allows for further\n configuration, like customizing the expiry date for a preview channel or\n setting a non-live channel to deploy to when a PR is merged.\n [Learn about the available configuration options.](//github.com/marketplace/actions/deploy-to-firebase-hosting#options)\n\n- Learn more about\n [GitHub Actions](//docs.github.com/en/free-pro-team@latest/actions),\n in general."]]