Arrange entrypoint for firebase.json file in github workflow

Viewed 208

The React project is meant to be hosted on Firebase Hosting service. I followed the instructions and deployed the version I want successfully. It also asked if I wanted to combine the project with Github Workflow. This means that it will pull my project's main branch and merge (automatically deploy) it to firebase, build and finish the deployment.
The issue here is that the React folder is in ./frontend directory, not in the root. The first error that popped up was:

Verifying firebase.json exists

  Error: firebase.json file not found. If your firebase.json file is not in the root of your repo, edit the entryPoint option of this GitHub action.

Ass suggestion said I added entrypoint variable to both ...-merge.yml and ...pull-request.yml files:

------
      - uses: actions/checkout@v2
      - run: cd ./frontend; npm ci && npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          entrypoint: /frontend
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_LIFT_OS }}"
------

Lately getting the error above, saying that the directory doesn't exist:

Error changing to directory /frontend: Error: ENOENT: no such file or directory, chdir '/home/runner/work/<project-name>/<project-name>' -> '/frontend'

I expect to locate the folder named frontend which has the React project and is in the root directory, without errors. How to locate it properly?

1 Answers

Regarding the documentation you should use entryPoint instead of entrypoint. You can also check out the Pull Request and issue for adding the entryPoint option. There you will find the info regarding the notation:

The name entryPoint was chosen to feel similar to a workflow file's entrypoint, which doesn't work with JS Actions, but also maintain camel case to match the other options for this Action.

The entrypoint you're using is the GitHub entrypoint for docker commands and is meant to be used with Docker container actions, but you can also use it with JavaScript actions that don't define any inputs.

Also check the path for your entryPoint. Default is set to . which means the root of your repo. So you should use ./frontend instead of /frontend. With / the action will check for a folder on your runners root and with ./ on your repo level. Here an example:

$ pwd
/Users/{USER}

$ cd ./Library
$ pwd
/Users/{USER}/Library

$ cd /Library
$ pwd
/Library
Related