Currently, the website is rebuilt on qemu-project.org using an update hook. We can reuse instead the Jekyll output of GitLab's CI.
To do so, a new user qemu-deploy has been created on qemu.org. The private key is stored into a file variable SSH_PRIVATE_KEY_FILE (be careful to include the trailing newline after "---END OPENSSH PRIVATE KEY---"!). Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- .gitlab-ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fa3041..129b2ff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,11 @@ +stages: + - build + - update + pages: image: centos:8 + stage: build cache: paths: - vendor @@ -14,3 +19,26 @@ pages: artifacts: paths: - public + +deploy: + image: centos:8 + stage: update + needs: + - job: pages + artifacts: true + before_script: + - dnf install -y openssh-clients rsync + - eval $(ssh-agent -s) + - cat "$SSH_PRIVATE_KEY_FILE" | tr -d '\r' | ssh-add - + - mkdir -m700 -p ~/.ssh + - - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config' + script: + - ssh $SSH_DEPLOY_DESTINATION "cd /var/www/qemu-project.org && mkdir new && rsync -az root/ new" + - rsync -avz --delete public/ $SSH_DEPLOY_DESTINATION:/var/www/qemu-project.org/new + - ssh $SSH_DEPLOY_DESTINATION "cd /var/www/qemu-project.org && rm -rf old && mv root old && mv new root" + only: + refs: + - master + variables: + - $SSH_PRIVATE_KEY_FILE + - $SSH_DEPLOY_DESTINATION -- 2.29.2