Created
March 14, 2019 01:07
-
-
Save megrxu/94e825d74ae0ddb5f8eab9da3422258b to your computer and use it in GitHub Desktop.
Circle CI config for Hugo + GitHub Pages + Custom Domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [email protected] | |
git config user.email "[email protected]" | |
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