مستقر به زندگی & پیش نمایش کانال ها از طریق درخواست های کششی GitHub
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
میتوانید از طریق یک GitHub Action، استقرارها را با Firebase Hosting ادغام کنید. این چیزی است که این اکشن GitHub می تواند برای شما انجام دهد:
یک کانال پیش نمایش جدید (و URL پیش نمایش مرتبط با آن) برای هر روابط عمومی در مخزن GitHub شما ایجاد می کند.
نظری را با URL پیشنمایش به PR اضافه میکند تا شما و هر بازبینی بتوانید تغییرات PR را در نسخه «پیشنمایش» برنامهتان مشاهده و آزمایش کنید.

URL پیشنمایش را با تغییرات هر commit با استقرار خودکار در کانال پیشنمایش مرتبط بهروزرسانی میکند. URL با هر commit جدید تغییر نمی کند.
(اختیاری) هنگام ادغام روابط عمومی، وضعیت فعلی مخزن GitHub شما را در کانال زنده شما مستقر می کند.
یادآوری: هنگام استفاده از URL های پیش نمایش، برنامه شما با منابع واقعی پروژه Firebase شما تعامل دارد.
اکشن GitHub را برای استقرار در Firebase Hosting تنظیم کنید
یک مخزن GitHub (عمومی یا خصوصی) ایجاد کنید یا از یک مخزن موجود استفاده کنید. شما باید مجوزهای مدیریت مخزن را داشته باشید.
در نسخه محلی مخزن خود، Firebase Hosting با استفاده از دستور firebase init
راه اندازی کنید.
اگر Hosting را راهاندازی نکردهاید، این نسخه از دستور را از ریشه دایرکتوری محلی خود اجرا کنید:
firebase init hosting
اگر قبلاً Hosting را راهاندازی کردهاید، فقط باید بخش GitHub Action Hosting راهاندازی کنید. این نسخه از دستور را از ریشه دایرکتوری محلی خود اجرا کنید:
firebase init hosting:github
اعلانهای CLI را دنبال کنید، و فرمان بهطور خودکار از تنظیم اکشن GitHub مراقبت میکند:
یک حساب سرویس در پروژه Firebase شما با مجوز استقرار در Firebase Hosting ایجاد می کند.
کلید JSON آن حساب سرویس را رمزگذاری می کند و آن را به عنوان یک راز GitHub در مخزن مشخص شده GitHub آپلود می کند.
فایل های پیکربندی yaml
گردش کار GitHub را می نویسد که به راز تازه ایجاد شده ارجاع می دهد. این فایلها اکشن GitHub را برای استقرار در Firebase Hosting پیکربندی میکنند.
در GitHub، یک شعبه جدید ایجاد کنید و فایلهای yaml
گردش کار ایجاد شده توسط CLI را commit کنید.
شعبه را در مخزن GitHub خود منتشر کنید.
شعبه را ادغام کنید.
همین! هر روابط عمومی بعدی در این مخزن GitHub به طور خودکار "URL پیش نمایش" خود را دریافت می کند!
درباره اکشن GitHub بیشتر بدانید
Firebase اکشن GitHub "Deploy to Firebase Hosting " را به عنوان یک پروژه منبع باز نگهداری می کند. کد منبع را مشاهده کنید.
اکشن GitHub "Deploy to Firebase Hosting " به پیکربندی بیشتر اجازه می دهد، مانند سفارشی کردن تاریخ انقضا برای یک کانال پیش نمایش یا تنظیم یک کانال غیر زنده برای استقرار در هنگام ادغام یک PR. با گزینه های پیکربندی موجود آشنا شوید.
به طور کلی درباره GitHub Actions بیشتر بدانید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-08 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-08 بهوقت ساعت هماهنگ جهانی."],[],[],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."]]