Created
June 13, 2020 13:03
-
-
Save petarnikolovski/cfddad4f1a421aeb4cc4d3af9da3722f to your computer and use it in GitHub Desktop.
Deploy Hugo with GitLab CI
This file contains 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
# 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