From 55a4419d78eada59ead430ac81ac842eeccd9f8d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 20 May 2022 21:11:49 +0200 Subject: workflows/ci: rsync _site/ to server --- .github/workflows/ci.yml | 10 ++++++++++ Makefile | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29cb911..01b2920 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,13 @@ jobs: run: | nohup make serve & sleep 3 && make wget + - name: Set up ssh-agent + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: '${{ secrets.REMOTE_SSH_KEY }}' + - name: Deploy + run: make deploy + env: + REMOTE_USER: '${{ secrets.REMOTE_USER }}' + REMOTE_HOST: '${{ secrets.REMOTE_HOST }}' + REMOTE_DIR: '${{ secrets.REMOTE_DIR }}' diff --git a/Makefile b/Makefile index c0214f0..2c9f077 100644 --- a/Makefile +++ b/Makefile @@ -50,3 +50,15 @@ wget: .PHONY: view view: xdg-open '$(call escape,$(URL))' &> /dev/null + +REMOTE_USER ?= who +REMOTE_HOST ?= where +REMOTE_DIR ?= /path/to/dir + +$(eval $(call noexpand,REMOTE_USER)) +$(eval $(call noexpand,REMOTE_HOST)) +$(eval $(call noexpand,REMOTE_DIR)) + +.PHONY: deploy +deploy: + rsync -avh -e 'ssh -o StrictHostKeyChecking=no' _site/ '$(call escape,$(REMOTE_USER)@$(REMOTE_HOST):$(REMOTE_DIR)/)' --delete -- cgit v1.2.3