Skip to content

Instantly share code, notes, and snippets.

@megrxu
Created March 14, 2019 01:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megrxu/94e825d74ae0ddb5f8eab9da3422258b to your computer and use it in GitHub Desktop.
Save megrxu/94e825d74ae0ddb5f8eab9da3422258b to your computer and use it in GitHub Desktop.
Circle CI config for Hugo + GitHub Pages + Custom Domain
version: 2
workflows:
version: 2
build:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
jobs:
build:
docker:
- image: cibuilds/hugo:latest
working_directory: ~/blog
environment:
HUGO_BUILD_DIR: public
steps:
- run: apk update && apk add git
- checkout
- run: HUGO_ENV=production hugo -F -v -d $HUGO_BUILD_DIR
- persist_to_workspace:
root: public
paths: .
deploy:
docker:
- image: node:8.10.0
steps:
- checkout
- attach_workspace:
at: public
- run:
name: Disable jekyll builds
command: touch public/.nojekyll
- run:
name: Custom Domain
command: echo "example.domain" > public/CNAME
- run:
name: Install and configure dependencies
command: |
npm install -g --silent gh-pages@2.0.1
git config user.email "ci-build@example.domain"
git config user.name "ci-build"
- add_ssh_keys:
fingerprints:
- "a4:2f:c8:ed:e9:cd:b7:70:36:18:f8:55:c9:16:f2:5c"
- run:
name: Delete All SSH keys and Add the installed one
command: ssh-add -D && ssh-add ~/.ssh/id_rsa_a42fc8ede9cdb7703618f855c916f25c
- run:
name: Deploy docs to gh-pages branch
command: gh-pages --dotfiles --message "[skip ci] Updates" --dist public
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment