サーバーでレンダリングされる Angular または Next.js アプリを構築する場合は、最新のウェブ フレームワーク向けのフルスタック ソリューションである次世代の
Firebase App Hosting をご確認ください。
GitHub pull リクエストによるライブチャネルとプレビュー チャネルへのデプロイ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
GitHub アクションを介して Firebase Hosting へのデプロイを統合できます。この GitHub アクションでは、次のことができます。
GitHub リポジトリに、PR ごとに新しいプレビュー チャネル(および関連するプレビュー URL)を作成します。
PR にプレビュー URL とともにコメントを追加します。これにより、デベロッパーとレビュー担当者は、アプリの「プレビュー」版で PR の変更を表示してテストできます。

関連するプレビュー チャネルに自動的にデプロイすることで、commit ごとの変更を加えてプレビュー URL を更新します。commit のたびに URL が変わることはありません。
(オプション)PR が統合されるときに、GitHub リポジトリの現在の状態をライブチャネルにデプロイします。
注意: プレビュー URL を使用する場合、アプリは Firebase プロジェクトの実際のバックエンド リソースとやり取りします。
GitHub アクションを設定して Firebase Hosting にデプロイする
GitHub リポジトリ(公開または非公開)を作成するか、既存のリポジトリを使用します。リポジトリの管理者権限が必要です。
リポジトリのローカル バージョンで、firebase init
コマンドを使用して Firebase Hosting を設定します。
CLI のプロンプトに表示される手順を実行すると、コマンドによって GitHub アクションの設定が自動的に処理されます。
Firebase プロジェクトに、Firebase Hosting へのデプロイ権限を持つサービス アカウントを作成します。
そのサービス アカウントの JSON キーを暗号化して、指定された GitHub リポジトリに GitHub シークレットとしてアップロードします。
新しく作成したシークレットを参照する GitHub ワークフロー yaml
構成ファイルを書き込みます。これらのファイルでは、Firebase Hosting にデプロイするための GitHub アクションを構成します。
GitHub で新しいブランチを作成し、CLI で作成されたワークフロー yaml
ファイルを commit します。
ブランチを GitHub リポジトリに公開します。
ブランチを統合します。
これで、この GitHub リポジトリに追加される以降の PR には自動的に独自の「プレビュー URL」が作成されます。
GitHub アクションの詳細
Firebase はオープンソース化するプロジェクトとして「Deploy to Firebase Hosting」GitHub アクションを保持しています。ソースコードをご覧ください。
「Deploy to Firebase Hosting」GitHub アクションでは、プレビュー チャネルの有効期限をカスタマイズしたり、PR が統合されたときにライブ以外のチャネルをデプロイするように設定したりといった構成を追加できます。利用可能な構成オプションの詳細をご覧ください。
GitHub アクション全般の概要をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-13 UTC。
[null,null,["最終更新日 2025-08-13 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."]]