Skip to content

Instantly share code, notes, and snippets.

@petarnikolovski
Created June 13, 2020 13:03
Show Gist options
  • Save petarnikolovski/cfddad4f1a421aeb4cc4d3af9da3722f to your computer and use it in GitHub Desktop.
Save petarnikolovski/cfddad4f1a421aeb4cc4d3af9da3722f to your computer and use it in GitHub Desktop.
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