Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deploy Hugo with GitLab CI
# Read the full article on https://softwareadept.xyz/2020/06/deploying-hugo-with-gitlab-ci/
stages:
- build
- deploy
build:
stage: build
image: registry.gitlab.com/pages/hugo:latest
script:
- hugo
artifacts:
paths:
- public
deploy:
stage: deploy
image: alpine:latest
before_script:
- apk add --upadte --no-cache rsync openssh-client
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo ${SSH_PRIVATE_KEY} | base64 -d > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa ${DO_HOST} >> ~/.ssh/known_hosts
script:
- rsync -az --delete public/ ${DO_USER}@${DO_HOST}:${DO_PATH}
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.