From cf24a91e73d22e03573a55a9e0629566e8e09344 Mon Sep 17 00:00:00 2001 From: Alexandru Date: Wed, 14 Aug 2024 15:45:05 +0300 Subject: [PATCH] attempt to make automatic deployment possible --- .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a32fa9e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,30 @@ +image: registry.gitlab.com/pages/hugo:latest + +stages: + - build + - upload + +before_script: + - apt-get update + - apt-get install -y rsync openssh-client + +build: + stage: build + script: + - hugo + artifacts: + paths: + - public/ + expire_in: 1 hour + +upload: + stage: upload + script: + - mkdir -p ~/.ssh + - echo "$PRIVKEY" | base64 -d > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - ssh-keyscan -p 69 107.189.28.28 >> ~/.ssh/known_hosts + - rsync -avzh ./public/ -e "ssh -i ~/.ssh/id_rsa -p 69" root@107.189.28.28:/var/www/fzorb.xyz + - ssh -i ~/.ssh/id_rsa -p 69 root@107.189.28.28 "chmod 755 -R /var/www/fzorb.xyz" + only: + - main