Here is my deployment with gitlab-ci and rsnc
- Login via ssh on the remote server
- ssh-keygen -t rsa -b 4096
- cd .ssh
- cp id_rsa_id.pub authorized.keys
- copy the content from id_rsa as PRIVATE_HOST_KEY
- ssh-keyscan example.com
- copy the content from ssh-keyscan as PRIVATE_HOST_KEY
.gitlab-ci.yml
# All available Hugo versions are listed here: https://gitlab.com/pages/hugo/container_registry
# image: registry.gitlab.com/pages/hugo:latest
image: monachus/hugo:latest
before_script:
- apt-get update
- apt-get --yes --force-yes install git ssh rsync
- git submodule update --init --recursive
pages:
script:
- hugo
- mkdir "${HOME}/.ssh"
- echo "${SSH_HOST_KEY}" > "${HOME}/.ssh/known_hosts"
- echo "${SSH_PRIVATE_KEY}" > "${HOME}/.ssh/id_rsa"
- chmod 700 "${HOME}/.ssh/id_rsa"
- rsync -hrvz --delete --exclude=_ public/ user@example.com:www/test/
artifacts:
paths:
- public
only:
- master
test:
script:
- hugo
except:
- master