I have this specific use case that I'm trying to solve with Firebase Hosting and it's the following:
The problem that I'm facing is that I want to trigger a Gridsome build + Firebase Hosting deploy whenever I publish a new blog post on my Headless CMS (It has the option to make a POST on new blog post). I know this is possible on other solutions like Vercel, but right now I'm using Firebase and would like to stick to the suite.
I've tried using the REST API without any luck, and Github Webhooks works the other way around and doesn't solve my problem. I'm thinking there might be a chance to call a Firebase function and use the CLI to deploy or something.
What I would like to know is if this feature exists and how to accomplish this scenario.
Thanks.
I assume you use Github Actions to build your project and then deploy it to firebase.
The easiest solution that I would recommend for you is to set up your Action to trigger not only on a push into your master branch, but also for a request.
Set your Action trigger for the repository_dispatch
Event
on:
repository_dispatch:
Then create an Access token for your Github Account with repo
and workflow
permission.
Now you just have to set your CMS Post Request on the following URL https://api.github.com/repos/<username>/<repo>/dispatches
with your Authorization Token in the Header.
Example:
curl --url 'https://api.github.com/repos/<USERNAME>/<REPO>/dispatches' \
--header 'authorization: Bearer <TOKEN>' \
--data '{"event_type": "content updated"}'
Now your Action should also dispatch whenever you make a POST Request from your CMS to the endpoint.