Frederiko Ribeiro
Frederiko Ribeiro

Reputation: 2358

How to programatically deploy to Firebase Hosting?

The problem

I have configured a project that currently is possible to deploy to Firebase Hosting multi sites by using the Firebase CLI.

The problem is that currently I am doing this manually. And I want to programatically do this, and if possible, using NodeJS.

The steps of my system:

Currently I am doing like this:

  1. First create the site page with, where game-project-id-unique should be unique:

firebase hosting:sites:create game-project-id-unique

  1. Then, add the target/project ID linked to the game, where game-id is defined by us:

firebase target:apply hosting game-id game-project-id-unique

  1. Add to the firebase.json the configuration of the file (array):
 {
      "target": "game-id",
      "public": "games/game-id",
      "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
 }
  1. Then, to publish:

firebase deploy --only hosting

Possible solutions?

I have researched here, I have found out that is possible to use the API-DEPLOY or the CLOUD BUILD, but this is not enough to guide me into the programatically approach, without the need of a human in-between.

Is there a way of doing this? Is it even possible?

Upvotes: 0

Views: 296

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317342

You can certainly just write a script that invokes the CLI. This is very common.

You can also use the Firebase Hosting REST API, but in my opinion that is going to be a lot more work.

Upvotes: 1

Related Questions