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:
- User uploads a .zip file with a index.html
- I extract and check the .zip file with NodeJS
- I deploy the files to Firebase Hosting
Currently I am doing like this:
- First create the site page with, where game-project-id-unique should be unique:
firebase hosting:sites:create game-project-id-unique
- 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
- Add to the firebase.json the configuration of the file (array):
{
"target": "game-id",
"public": "games/game-id",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
}
- 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?