diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..11b114e --- /dev/null +++ b/action.yml @@ -0,0 +1,46 @@ +name: My Deployment 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/website + cd website + git submodule init + git submodule update --recursive + + - name: generate site + run: | + cd website + 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/fzorb.xyz/*" + + - name: upload new files + run: | + rsync -avzh yourrepository/public/ -e "ssh -i ~/.ssh/id_rsa -p 69" gitlab@107.189.28.28:/var/www/fzorb.xyz + + - name: fix perms + run: | + ssh -i ~/.ssh/id_rsa -p 69 gitlab@107.189.28.28 "chmod 755 -R /var/www/fzorb.xyz"