On Tue, Jan 19, 2021 at 10:37:46AM +0100, Paolo Bonzini wrote:
Currently, the website is rebuilt on qemu-project.org using
an update hook. We can reuse instead the Jekyll output of
GitLab's CI.
Are there any files present on the qemu-project.org webroot
other than the published output of Jekyll ? QEMU had the
good sense to use sub-domains git.qemu-project.org and
download.qemu-project.org for other content. So maybe you
just turn the root qemu-project.org and www.qemu-project.org
domains into CNAME records pointing to the gitlab pages site ?
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5fa3041..08b6d20 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 -avz root/ new"
Why copy the old root into the new root ? This means that any time we delete
a file in git, it will never be removed from the live webroot.