Hugo + bitbucket + firebase

@exrishu I was curious about this, so I got it working for one of my sample projects. I followed the hugo docs for hosting on firebase, as is.

My sample project, now in firebase: https://hugo-os-stat-function.firebaseapp.com/

As @RickCogley mentioned, you should confirm the settings in your firebase.json file (see mine below). Also, make sure you are running hugo to generate your static site before you run firebase deploy.

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

Update: I got this working with Wercker CI. Now everytime I do a git push, it will deploy the site to firebase automatically. A few notes:

  • First, follow the hugo docs on deployment with wercker to link your Bitbucket account to your Wercker account, but stop once you get to the heading named Use the Hugo-build Step
  • Run firebase login:ci locally to generate your token
  • Create 2 environment variables in your wercker build pipeline: FIREBASE_TOKEN which will be the generated token from the previous step, and FIREBASE_PROJECT_NAME which is the name of your firebase project
  • Add this (or replace your existing) wercker.yml file to the root of your site, then update the hugo version as desired:
box: debian
build:
  steps:
    - arjen/hugo-build:
        version: "0.50"
    - script:
        name: update apt-get
        code: apt-get update
    - script:
        name: install curl
        code: apt-get install -y curl
    - script:
        name: install gnupg
        code: apt-get install -y gnupg
    - script:
        name: install node
        code: |
          curl -sL https://deb.nodesource.com/setup_11.x | bash -
          apt-get install -y nodejs
    - script:
        name: install firebase
        code: npm install -g firebase-tools
    - devillexio/firebase-deploy@1.2.0:
        project: $FIREBASE_PROJECT_NAME
        token: $FIREBASE_TOKEN

For reference, here’s the GitHub repo that Wercker deploys to Firebase from.

3 Likes