The following Github Action will successfully build and deploy your Hugo static-site and upload it to Google Firebase Hosting.
Pre-requisites
You will need firebase tools installed on your local machine to obtain a firebase token. If you haven't got it installed then you can install it by running npm install -g firebase-tools
.
firebase login
, which opens a browser where you can select your account. Use firebase logout
in case you are already logged in but to the wrong account.firebase init
command. From here:
firebase login:ci
Within your repo select the Actions
tab. Create a new workflow and paste the following:
on: [push]
name: Deploy Hugo to Firebase
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: ryank90/action-hugo-firebase-deploy@master
with:
firebase-token: ${{ secrets.firebase_token }}
alias: ${{ alias }} // Optional
hugo-params: -D // Optional. Any params for the `hugo` command. [Refer doc here](https://gohugo.io/commands/hugo/)
Save and you are ready to push code to your repo and have it deployed.