Skip to content

epam/epmgcip-chaperone.admin

Repository files navigation

Instruction for setting up firebase hosting.

  1. Create a github account
  2. Create a firebase account
  3. Go to a Firebase Console (https://console.firebase.google.com/) and create a new project
  4. On a local instance go to a console and run "npm install -g firebase-tools"
  5. Run "firebase login" to login into your account.
  6. Run "firebase init hosting"
    a) choose "Use an existing project"
    b) select the created project
    c) "What do you want to use as your public directory" - skip, "public" by default
    d) "Configure as a single-page app" - y
    e) "Set up automatic build and deploys- with GitHub" - y
    f) type existed repository using format "user/repository"
    g) "Set up wotkflow to run a build script before every deploy" - y
    h) "What script should be run before every deploy" - choose default - "npm ci && npm run build"
    i) "Set up autpmatic deployment to your site's live channel when a PR is a merged" - y
    j) "What is the name of the GitHub branch associated with your site's live channel" - choose default - "main"

For handling multiple environments:

  1. Go to a Firebase Console (https://console.firebase.google.com/) -> Hosting -> Add another site Screenshot 2024-07-23 131226
  2. Add a website id, e.g. "staging-website"
  3. Update firebase json by adding a new site for "staging-website" and corrected main website. "site" should be equal to your site ID in firebase. e.g.
{
  "hosting": [{
    "site": "production",
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }, {
    "site": "staging-website",
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }]
}