Build and deploy with make

This commit is contained in:
Yorick Barbanneau 2022-12-05 01:00:52 +01:00
parent b3b8be6e38
commit 3c5cc3e576
2 changed files with 54 additions and 11 deletions

29
Makefile Normal file
View file

@ -0,0 +1,29 @@
# Includes
-include include.mk
# deploy variables
DEPLOY_BIN?=rsync
DEPLOY_OPTS?=-avz --delete
BUILD_OPTS?=--gc --cleanDestinationDir
BUILD_DEST?=public
.PHONY: serve
serve:
@hugo server -D --disableFastRender -v
.PHONY: build
build:
@hugo -d $(BUILD_DEST) $(BUILD_OPTIONS)
.PHONY: clean
clean:
@[ -d $(BUILD_DEST) ] && rm -rf $(BUILD_DEST)
.PHONY: deploy
deploy:
ifeq ($(DEPLOY_SERVER),)
$(error DEPLOY_SERVER is not defined)
endif
[ -d $(BUILD_DEST) ] && $(DEPLOY_BIN) $(DEPLOY_OPTS) $(BUILD_DEST)/ $(DEPLOY_SERVER):$(DEPLOY_FOLDER)