From e1c2bd199e08e2d903b92c13a19f8b90b648100d Mon Sep 17 00:00:00 2001 From: Alexandru Date: Wed, 18 Sep 2024 12:15:44 +0300 Subject: [PATCH] add pipeline --- .gitea/workflows/action.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .gitea/workflows/action.yml diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml new file mode 100644 index 0000000..5ae9322 --- /dev/null +++ b/.gitea/workflows/action.yml @@ -0,0 +1,46 @@ +name: pipeline + +on: + push: + branches: + - main + +jobs: + deploy-job: + runs-on: ubuntu-latest + steps: + - name: init env + run: | + sudo apt-get update + sudo apt-get install -y rsync openssh-client hugo git + + - name: init git + run: | + git clone https://git.fzorb.xyz/fzorb/zorbmail-web website + cd website + + - name: generate site + run: | + ls -a + cd website + ls -a + hugo + + - name: init ssh + run: | + mkdir -p ~/.ssh + echo "${{ secrets.PRIVKEY }}" | base64 -d > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -p 69 107.189.28.28 >> ~/.ssh/known_hosts + + - name: delete new files so we don't screw up stuff + run: | + ssh -i ~/.ssh/id_rsa -p 69 gitlab@107.189.28.28 "rm -rf /var/www/mail.fzorb.xyz/*" + + - name: upload new files + run: | + rsync -avzh website/public/ -e "ssh -i ~/.ssh/id_rsa -p 69" gitlab@107.189.28.28:/var/www/mail.fzorb.xyz + + - name: fix perms + run: | + ssh -i ~/.ssh/id_rsa -p 69 gitlab@107.189.28.28 "chmod 755 -R /var/www/mail.fzorb.xyz" \ No newline at end of file