פריסה בשידור חי & תצוגה מקדימה של ערוצים באמצעות בקשות משיכה ב-GitHub
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אפשר לשלב פריסות ל-Firebase Hosting באמצעות GitHub Action. אלה הפעולות שאפשר לבצע באמצעות פעולת GitHub הזו:
יוצר ערוץ תצוגה מקדימה חדש (ואת כתובת ה-URL המשויכת לתצוגה המקדימה) לכל בקשת משיכה במאגר GitHub שלכם.
הפעולה מוסיפה הערה לבקשת המיזוג עם כתובת ה-URL של התצוגה המקדימה,
כך שאתם וכל בודק יכולים לראות ולבדוק את השינויים בבקשת המיזוג בגרסת 'תצוגה מקדימה' של האפליקציה.

מעדכן את כתובת ה-URL של התצוגה המקדימה בשינויים מכל פעולת commit על ידי פריסה אוטומטית לערוץ התצוגה המקדימה המשויך. כתובת ה-URL לא משתנה עם כל קומיט חדש.
(אופציונלי) פריסת המצב הנוכחי של מאגר GitHub בערוץ הפעיל שלכם כשממזגים את בקשת משיכת השינויים.
תזכורת: כשמשתמשים בכתובות URL לתצוגה מקדימה, האפליקציה מקיימת אינטראקציה עם משאבי ה-Backend האמיתיים של פרויקט Firebase.
הגדרת פעולת GitHub לפריסה ב-Firebase Hosting
יוצרים מאגר GitHub (ציבורי או פרטי) או משתמשים במאגר קיים. צריכות להיות לכם הרשאות אדמין במאגר.
בגרסה מקומית של המאגר, מגדירים את Firebase Hosting באמצעות הפקודה firebase init
.
אם לא הגדרתם את Hosting, מריצים את הגרסה הזו של הפקודה מהספרייה הראשית המקומית:
firebase init hosting
אם כבר הגדרתם את Hosting, אתם צריכים להגדיר רק את החלק של GitHub Action ב-Hosting. מריצים את הגרסה הזו של הפקודה מהרמה הבסיסית (root) של הספרייה המקומית:
firebase init hosting:github
פועלים לפי ההנחיות ב-CLI, והפקודה תדאג באופן אוטומטי להגדרת GitHub Action:
יוצר חשבון שירות בפרויקט Firebase עם הרשאה לפריסה אל Firebase Hosting.
מצפין את מפתח ה-JSON של חשבון השירות ומעלה אותו למאגר GitHub שצוין כסוד של GitHub.
כותב קובצי הגדרות של תהליך עבודה ב-GitHub yaml
שמפנים לסוד שנוצר. הקובץ הזה מגדיר את פעולת GitHub לפריסה אל Firebase Hosting.
ב-GitHub, יוצרים הסתעפות חדשה ומבצעים commit לקובצי yaml
של תהליך העבודה שנוצרו על ידי ה-CLI.
מפרסמים את ההסתעפות במאגר שלכם ב-GitHub.
ממזגים את הענף.
זהו זה! כל בקשת משיכה (PR) שתוגש בהמשך במאגר הזה ב-GitHub תקבל באופן אוטומטי כתובת URL משלה לתצוגה מקדימה.
מידע נוסף על GitHub Action
Firebase מתחזקת את פעולת GitHub 'Deploy to Firebase Hosting' כפרויקט קוד פתוח.
הצגת קוד המקור.
הפעולה "Deploy to Firebase Hosting" (פריסה אל Firebase Hosting) ב-GitHub מאפשרת לבצע הגדרות נוספות, כמו התאמה אישית של תאריך התפוגה של ערוץ תצוגה מקדימה או הגדרה של ערוץ לא בשידור חי לפריסה אליו כשמתבצע מיזוג של בקשת משיכה.
מידע על אפשרויות ההגדרה הזמינות
מידע נוסף על GitHub Actions
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-08 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-08 (שעון UTC)."],[],[],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."]]