diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a5b7bde --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +stages: + - build + - deploy + +build-job: + stage: build + before_script: + - apt-get update && apt-get install -y hugo + script: + - hugo --minify + artifacts: + paths: + - public/ + only: + - main + +deploy-job: + stage: deploy + before_script: + # stolen from https://help.ovhcloud.com/csm/asia-vps-deploy-website-gitlab-ci-cd?id=kb_article_view&sysparm_article=KB0066282 + # and from https://docs.gitlab.com/ci/jobs/ssh_keys/ + - apt-get update && apt-get install -y rsync openssh-client + + - eval $(ssh-agent -s) + - chmod 400 "$SSH_PRIVATE_KEY" + - ssh-add "$SSH_PRIVATE_KEY" + + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + + - cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + script: + - rsync -avz --delete public/ debian@wasp.best:/var/www/html/ + only: + - main