My overall setup was similar to that in ariya’s blog, and the components I used were as follow:
Set up a domain or subdomain. I used namecheap, but there are plenty of options to choose from.
Referencing quickstart to set up Hugo, here’s the procedure (and command line code below) for mac:
Install Go and Hugo
# For Mac
brew install go
brew install hugo
# For Linux
snap install hugo --channel=extended
Create a directory (…/<website>) and set it up for Hugo
mkdir .../<website>
hugo new site .../<website>
Add some content (change the value of draft to ‘false’ in file to make it visible)
hugo new about.md # then edit this file
Clone a bunch of default themes, or just choose just one theme or download (or create your own)
git clone --recursive https://github.com/spf13/hugoThemes themes
Edit the file config.toml to tailor the theme to your need (e.g. set baseurl = “http://blog.example.com/"), then build the site locally to see the results
hugo server --theme=<theme> #Build site (specify folder name in themes)
npm install -g firebase-tools
firebase login:ci
SSH config: Generate ssh key pair (I renamed it to gitlab and gitlab.pub) In ~/.ssh/config add (IdentityFile should be private key):
Host gitlab.com
HostName gitlab.com
PubkeyAuthentication yes
IdentityFile ~/.ssh/gitlab
Create/edit firebase.json file and place it in the hugo-blog directory. The file should contain the following:
{
"hosting": {
"public": "public"
}
}
Add environment variables FIREBASE_TOKEN and FIREBASE_PROJECTID in “Settings - CI/CD”
variables:
GIT_SSL_NO_VERIFY: "true"
stages:
- deploy
deploy:
stage: deploy
image: nohitme/hugo-firebase
script:
# build site
- cd ${CI_PROJECT_DIR}
- rm -rf public
- hugo --theme=hugo-theme-cactus-plus-mod
# upload
- firebase deploy --token ${FIREBASE_TOKEN} --project ${FIREBASE_PROJECTID}
only:
- master