blog/Makefile

31 lines
776 B
Makefile
Raw Normal View History

2020-07-14 17:00:41 +02:00
.PHONY: all
2021-08-08 16:01:27 +02:00
all: build-dev
2020-07-14 17:00:41 +02:00
.PHONY: build-dev
build-dev:
HUGO_TITLE="Ambroisie's dev blog" HUGO_BASEURL=https://dev.belanyi.fr hugo -D -F
2020-07-14 17:00:41 +02:00
.PHONY: build-prod
build-prod:
2021-08-08 16:01:27 +02:00
HUGO_ENV=production hugo --minify
2020-07-14 17:00:41 +02:00
.PHONY: serve
2021-08-08 16:01:27 +02:00
serve:
hugo server -D -F
2020-07-14 17:00:41 +02:00
2021-08-08 16:23:51 +02:00
deploy:
@if [ -n "$$SSH_KEY" ]; then eval "$$(ssh-agent)"; echo "$$SSH_KEY" | ssh-add -; fi
@if [ -z "$$SSH_USER" ] || [ -z "$$SSH_HOST" ] || [ -z "$$SSH_TARGET" ]; \
then echo "Missing one of SSH_USER, SSH_HOST, or SSH_TARGET" >&2; \
exit 1; \
fi
mkdir -p ~/.ssh/
touch ~/.ssh/known_hosts
ssh-keygen -R "$$SSH_HOST"
ssh-keyscan "$$SSH_HOST" >> ~/.ssh/known_hosts
rsync -e "ssh -o StrictHostKeyChecking=no" --progress -avz --delete public/ "$$SSH_USER@$$SSH_HOST:$$SSH_TARGET"
2021-08-08 16:23:51 +02:00
2020-07-14 17:00:41 +02:00
.PHONY: clean
clean:
$(RM) -r public