Deploy to Firebase Hosting with Github Actions
Deploy application static assets to Firebase Hosting with Github Actions. You will love automation
To deploy application static assets to Firebase Hosting, It is not too hard if you are familiar with Firebase CLI. By the way, if you are in development environment, using Firebase CLI directly from your PC still is the most easiest way. But if you are runing in production environment, using Firebase CLI directly from your PC is too risky.
I believe that everyone love automation. So, letās move to automation. If you are using Github, then Github Actions will be you 1st chioce. In this blog post, I will only focusing on how to deploy to Firebase Hosting with Github actions. If you want to know how to set up Firebase Hosting, you will found it here.
Setup Workflow
Start with breakdown the workflow into steps.
- Authenticate to Firebase (need token)
- Deploy assests to Firebase Hosting (with
firebase deploy
)
Acquire Firebase token
Now, We need the Firebase token for authentication. This token can be aquired through the firebase login:ci
command. Keep it secure in Github repo setting -> Secrets.
Create Github Actions
Go to Acions tab on your Github repo. Create workflows by yourself. Then you can use my workflow. But please make sure you understand it.
At line 18. Iāve decided to use w9jds/firebase-action. Instead of using this action, We will need to install Firebase CLI by ourselves and use full Firebase command firebase deploy --token [YOUR_TOKEN] --only hosting --non-interactive
.
Now, try to trigger the workflow. You will see the magic is happening.
Conclusions
Even you work solo or team, development or production, Github Actions is very helpful.
Letās make is automation.